コード例 #1
0
        private ComboBoxWin ComboBox(ILookupComboBoxMapper mapper)
        {
            ComboBoxWin      comboBoxWin = null;
            IControlHabanero control     = mapper.Control;

            if (control is IComboBox)
            {
                comboBoxWin = (ComboBoxWin)control;
            }
            return(comboBoxWin);
        }
コード例 #2
0
        /// <summary>
        /// Removes event handlers previously assigned to the ComboBox
        /// </summary>
        /// <param name="mapper">The mapper for the lookup ComboBox</param>
        public void RemoveCurrentHandlers(ILookupComboBoxMapper mapper)
        {
            _mapper = mapper;
            _mapper = mapper;
            ComboBoxWin comboBoxWin = this.ComboBox(mapper);

            if (comboBoxWin != null)
            {
                comboBoxWin.SelectedIndexChanged -= _mapper.SelectedIndexChangedHandler;
            }
        }
コード例 #3
0
        /// <summary>
        /// Removes event handlers previously assigned to the ComboBox
        /// </summary>
        /// <param name="mapper">The mapper for the lookup ComboBox</param>
        public void RemoveCurrentHandlers(ILookupComboBoxMapper mapper)
        {
            _mapper = mapper;
            IControlHabanero control = mapper.Control;

            if (control is IComboBox)
            {
                ComboBoxWin comboBoxWin = (ComboBoxWin)control;
                comboBoxWin.SelectedIndexChanged   -= SelectIndexChangedHandler;
                _mapper.SelectedIndexChangedHandler = null;
            }
        }
コード例 #4
0
        public void AddItemSelectedEventHandler(ILookupComboBoxMapper mapper)
        {
            _mapper = mapper;
            IControlHabanero control = mapper.Control;

            if (control is IComboBox)
            {
                ComboBoxWin comboBoxWin = (ComboBoxWin)control;
                comboBoxWin.SelectedIndexChanged   += SelectIndexChangedHandler;
                _mapper.SelectedIndexChangedHandler = SelectIndexChangedHandler;
            }
        }
コード例 #5
0
        protected override EnumComboBoxMapper CreateComboBox(string propertyName, bool setBO)
        {
            EnumBO             bo                 = new EnumBO();
            ComboBoxWin        comboBox           = new ComboBoxWin();
            IControlFactory    controlFactory     = new ControlFactoryWin();
            EnumComboBoxMapper enumComboBoxMapper = new EnumComboBoxMapper(comboBox, propertyName, false, controlFactory);

            if (setBO)
            {
                enumComboBoxMapper.BusinessObject = bo;
            }
            return(enumComboBoxMapper);
        }
コード例 #6
0
        /// <summary>
        /// Adds event handlers to the ComboBox that are suitable for the UI environment
        /// </summary>
        /// <param name="mapper">The mapper for the lookup ComboBox</param>
        public void AddHandlers(ILookupComboBoxMapper mapper)
        {
            ComboBoxWin comboBoxWin = this.ComboBox(mapper);

            if (comboBoxWin != null)
            {
                comboBoxWin.KeyPress += delegate(object sender, System.Windows.Forms.KeyPressEventArgs e)
                {
                    if (e.KeyChar == 13)
                    {
                        mapper.ApplyChangesToBusinessObject();
                        mapper.UpdateControlValueFromBusinessObject();
                    }
                };
            }
        }
コード例 #7
0
        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");
        }