Esempio n. 1
0
        // ----------------------
        void ChangeSelection(enPropertyTarget propertyTarget, ColorOption colorOption, bool newValue)
        {
            if (newValue == false)
            {
                if (((propertyTarget == enPropertyTarget.BackgroundColor) && (BackgroundColorOption == colorOption)) ||
                    ((propertyTarget == enPropertyTarget.TextColor) && (TextColorOption == colorOption)))
                {
                    // Can't deselect the current item, as we don't know what else to select instead
                    colorOption.OnPropertyChanged("BackgroundSelected");
                }
                else
                {
                    colorOption.SetSelected(propertyTarget, false);
                }
            }
            else if ((propertyTarget == enPropertyTarget.BackgroundColor) && (colorOption == TextColorOption))
            {
                // Text and Background cannot be the same
                //TODO: Show message?
                colorOption.OnPropertyChanged("BackgroundSelected");
            }
            else if ((propertyTarget == enPropertyTarget.TextColor) && (colorOption == BackgroundColorOption))
            {
                // Text and Background cannot be the same
                //TODO: Show message?
                colorOption.OnPropertyChanged("TextSelected");
            }
            else
            {
                foreach (var item in _colorOptions)
                {
                    if (item != colorOption)
                    {
                        item.SetSelected(propertyTarget, false);
                    }
                }
                colorOption.SetSelected(propertyTarget, true);

                if (propertyTarget == enPropertyTarget.BackgroundColor)
                {
                    BackgroundColorOption = colorOption;
                }
                else if (propertyTarget == enPropertyTarget.TextColor)
                {
                    TextColorOption = colorOption;
                }
            }
        }
Esempio n. 2
0
 public void SetSelected(enPropertyTarget propertyTarget, bool newValue)
 {
     if (propertyTarget == enPropertyTarget.BackgroundColor)
     {
         if (_backgroundSelected != newValue)
         {
             _backgroundSelected = newValue;
             OnPropertyChanged("BackgroundSelected");
         }
     }
     else if (propertyTarget == enPropertyTarget.TextColor)
     {
         if (_textSelected != newValue)
         {
             _textSelected = newValue;
             OnPropertyChanged("TextSelected");
         }
     }
 }