Habanero.Faces.Win.ComboBoxDefaultMapperStrategyWin.RemoveCurrentHandlers C# (CSharp) Method

RemoveCurrentHandlers() public method

Removes event handlers previously assigned to the ComboBox
public RemoveCurrentHandlers ( IComboBoxMapper mapper ) : void
mapper IComboBoxMapper The mapper for the lookup ComboBox
return void
        public void RemoveCurrentHandlers(IComboBoxMapper mapper)
        {
            _mapper = mapper;
            var comboBox = mapper.GetControl() as ComboBox;
            if (comboBox == null) return;

            comboBox.SelectedIndexChanged -= SelectIndexChangedHandler;
            _mapper.SelectedIndexChangedHandler = null;
        }

Usage Example

 public void Test_RemoveCurrentHandlers_WhenMapperUsingHabaneroControl_ShouldAddBehaviours()
 {
     //---------------Set up test pack-------------------
     var comboBoxWin = new ComboBoxWin {Name = "TestComboBox", Enabled = true};
     var comboBoxMapper = new ComboBoxMapperStub(comboBoxWin);
     //---------------Assert Precondition----------------
     Assert.IsInstanceOf<IComboBox>(comboBoxMapper.Control);
     //---------------Execute Test ----------------------
     var comboBoxStrategyWin = new ComboBoxDefaultMapperStrategyWin();
     comboBoxStrategyWin.RemoveCurrentHandlers(comboBoxMapper);
     //---------------Assert Result----------------------
     Assert.IsTrue(true, "If an error was not thrown then we are OK");
 }
All Usage Examples Of Habanero.Faces.Win.ComboBoxDefaultMapperStrategyWin::RemoveCurrentHandlers