Inheritance: KryptonButtonDesigner
Beispiel #1
0
        /// <summary>
        /// Initialize a new instance of the KryptonCheckButtonActionList class.
        /// </summary>
        /// <param name="owner">Designer that owns this action list instance.</param>
        public KryptonCheckButtonActionList(KryptonCheckButtonDesigner owner)
            : base(owner)
        {
            // Remember the button instance
            _checkButton = owner.Component as KryptonCheckButton;

            // Assuming we were correctly passed an actual component...
            if (_checkButton != null)
            {
                // Get access to the actual Orientation propertry
                PropertyDescriptor checkedProp = TypeDescriptor.GetProperties(_checkButton)["Checked"];

                // If we succeeded in getting the property
                if (checkedProp != null)
                {
                    // Decide on the next action to take given the current setting
                    if ((bool)checkedProp.GetValue(_checkButton))
                    {
                        _action = "Uncheck the button";
                    }
                    else
                    {
                        _action = "Check the button";
                    }
                }
            }

            // Cache service used to notify when a property has changed
            _service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
        }