Habanero.Faces.Win.ComboBoxKeyPressMapperStrategyWin.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 comboBoxWin = mapper.GetControl() as ComboBox;
            if (comboBoxWin != null)
            {
                comboBoxWin.SelectedIndexChanged -= mapper.SelectedIndexChangedHandler;
            }
        }

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 ComboBoxKeyPressMapperStrategyWin();
     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.ComboBoxKeyPressMapperStrategyWin::RemoveCurrentHandlers