示例#1
0
        protected void ProcessArrowKey(Keys key, bool rotate)
        {
            PropertyValue unitValue = _ownerPropertyEnum.Property.GetValue(PropertyUnitLook.UnitValue);

            object[] displayStrings = unitValue.GetDisplayedValues();
            int      index          = -1;

            if (unitValue.HasMultipleValues)
            {
                if (key == Keys.Up)
                {
                    index = displayStrings.Length - 1;
                }
                else if (key == Keys.Down)
                {
                    index = 0;
                }
            }
            else
            {
                for (int i = 0; i < displayStrings.Length; i++)
                {
                    if (ListText.Equals(displayStrings[i]))
                    {
                        if ((key == Keys.Up) && (i > 0))
                        {
                            index = i - 1;
                        }
                        else if ((key == Keys.Up) && rotate)
                        {
                            index = displayStrings.Length - 1;
                        }
                        else if ((key == Keys.Down) && (i < displayStrings.Length - 1))
                        {
                            index = i + 1;
                        }
                        else if ((key == Keys.Down) && rotate)
                        {
                            index = 0;
                        }

                        break;
                    }
                }
            }

            if (index != -1)
            {
                ListText = displayStrings[index].ToString();

                if (RealtimeChange)
                {
                    CommitListChanges();
                }
            }
        }
示例#2
0
        public void CommitListChanges()
        {
            PropertyValue unitValue = _ownerPropertyEnum.Property.GetValue(PropertyUnitLook.UnitValue);
            string        oldValue  = unitValue.DisplayString;

            if (ListText.Equals(oldValue) == false)
            {
                unitValue.PreviousValue = unitValue.GetValue();
                unitValue.SetValueFromInPlaceCtrl(ListText);

                if (unitValue.DisplayString != oldValue)
                {
                    _ownerPropertyEnum.Property.ParentGrid.NotifyPropertyChanged(
                        new PropertyChangedEventArgs(_ownerPropertyEnum, unitValue.AdditionalValueKey));
                }
            }
        }