Habanero.Faces.Win.ControlMapperStrategyWin.RemoveCurrentBOPropHandlers C# (CSharp) Method

RemoveCurrentBOPropHandlers() public method

Removes handlers to events of a current business object property. It is essential that if the AddCurrentBoPropHandlers is implemented then this is implemented such that editing a business object that is no longer being shown on the control does not does not update the value in the control.
public RemoveCurrentBOPropHandlers ( ControlMapper mapper, IBOProp boProp ) : void
mapper Habanero.Faces.Base.ControlMapper The control mapper that maps the business object property to the control
boProp IBOProp The business object property being mapped to the control
return void
        public void RemoveCurrentBOPropHandlers(ControlMapper mapper, IBOProp boProp)
        {
            if (boProp != null)
            {
                boProp.Updated -= mapper.BOPropValueUpdatedHandler;
            }
        }

Usage Example

        public void Test_ControlMapperStrategy_AddBOPropHandlers()
        {
            //---------------Set up test pack-------------------
            ClassDef.ClassDefs.Clear();
            MyBO.LoadDefaultClassDef();
            var strategyWin = new ControlMapperStrategyWin();
            var factory = new Habanero.Faces.Win.ControlFactoryWin();
            var tb = factory.CreateTextBox();
            const string testprop = "TestProp";
            var stubMapper = new ControlMapperStub(tb, testprop, false, factory);
            var bo = new MyBO();
            var prop = bo.Props[testprop];
            const string origvalue = "origValue";
            prop.Value = origvalue;
            stubMapper.BusinessObject = bo;
            strategyWin.RemoveCurrentBOPropHandlers(stubMapper, prop);

            //--------------Assert PreConditions----------------            
            Assert.AreEqual(origvalue, tb.Text);

            //---------------Execute Test ----------------------
            strategyWin.AddCurrentBOPropHandlers(stubMapper, prop);
            const string newValue = "New value";
            prop.Value = newValue;

            //---------------Test Result -----------------------
            Assert.AreEqual(newValue, tb.Text);

        }
All Usage Examples Of Habanero.Faces.Win.ControlMapperStrategyWin::RemoveCurrentBOPropHandlers