Пример #1
0
        private void ButtonBearingGuideColor_Click(object sender, RoutedEventArgs e)
        {
            var ccw = new ColorChooserWindow(ColorSpace.Parse(Settings.Default.Preferences_Appearance_BearingGuideColor));

            if (ccw.ShowDialog() == true)
            {
                Settings.Default.Preferences_Appearance_BearingGuideColor = ccw.Colors[0].ToString();
            }
        }
Пример #2
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is ColorSpace colorSpace)
     {
         return(new SolidColorBrush(colorSpace.ToSystemWindowsMediaColor()));
     }
     if (value is string str)
     {
         return(new SolidColorBrush(ColorSpace.Parse(str).ToSystemWindowsMediaColor()));
     }
     throw new ArgumentException("Unable to convert specified object to SolidColorBrush");
 }
Пример #3
0
        private void ButtonCharacterSetColors_Click(object sender, RoutedEventArgs e)
        {
            var colors = from string colorString in Settings.Default.Preferences_Appearance_CharacterSetColors
                         select ColorSpace.Parse(colorString);

            var ccw = new ColorChooserWindow(colors.ToArray());

            if (ccw.ShowDialog() == true)
            {
                var strings = new StringCollection();
                foreach (var color in ccw.Colors)
                {
                    strings.Add(color.ToString());
                }
                Settings.Default.Preferences_Appearance_CharacterSetColors = strings;
                _csManager.ColorScheme = new ColorScheme(Settings.Default.Preferences_Appearance_CharacterSetColors);
            }
        }
Пример #4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ColorSpace colorSpace;

            switch (value)
            {
            case ColorSpace cs:
                colorSpace = cs;
                break;

            case string str:
                colorSpace = ColorSpace.Parse(str);
                break;

            default:
                throw new ArgumentException("Unable to convert specified object to SolidColorBrush");
            }

            return(new SolidColorBrush(colorSpace.GetAutoDarkenOrLighten().ToSystemWindowsMediaColor()));
        }