Exemplo n.º 1
0
        public OptionsViewModel()
        {
            LoadSettings();

            foreach (string name in AppTheme.Instance.ThemeNames)
            {
                ThemeNames.Add(name);
            }

            hasWindowsThemes = AppTheme.HasWindowsThemes;
            AppTheme.Instance.CurrentThemeChanged += (s, e) =>
            {
                CurrentTheme = AppTheme.Instance.CurrentThemeName;
            };
        }
        private void LoadedAction()
        {
            var preferences = PreferencesService.GetPreferences();

            Delimiter.Value = preferences.Delimiter;

            var count = 1;

            foreach (var modifierKey in ModifierKey1.Where(x => x != ModifierKeys.None && preferences.ShowHideShortcut.ModifierKeys.HasFlag(x)))
            {
                if (count == 1)
                {
                    var modifierKeyIndex = ModifierKey1.IndexOf(modifierKey);
                    SelectedModifierKey1.Value = modifierKeyIndex < 0 ? ModifierKeys.None : ModifierKey1[modifierKeyIndex];
                }
                if (count == 2)
                {
                    var modifierKeyIndex = ModifierKey2.IndexOf(modifierKey);
                    SelectedModifierKey2.Value = modifierKeyIndex < 0 ? ModifierKeys.None : ModifierKey2[modifierKeyIndex];
                    break;
                }
                count++;
            }

            var keyIndex = Keys.IndexOf(preferences.ShowHideShortcut.Key);

            SelectedKey.Value = keyIndex < 0 ? Key.None : Keys[keyIndex];

            Delimiter.Subscribe(_ => ClearMessage());
            SelectedModifierKey1.Subscribe(_ => ClearMessage());
            SelectedModifierKey2.Subscribe(_ => ClearMessage());
            SelectedKey.Subscribe(_ => ClearMessage());
            SelectedTheme.Subscribe(_ => ClearMessage());
            AutoLaunch.Subscribe(_ => ClearMessage());

            var themeIndex = ThemeNames.IndexOf(preferences.ThemeName);

            SelectedTheme.Value = themeIndex < 0 ? AppTheme.GenerateDefault().ThemeName : ThemeNames[themeIndex];

            AutoLaunch.Value = preferences.AutoLaunch;
        }
Exemplo n.º 3
0
 public IUserStateColorScheme GetStateColorSheme(ThemeNames theme)
 {
     return(_colorShemes[theme]);
 }
Exemplo n.º 4
0
        public static Color GetColor(this UserStateColorNames color, ThemeNames theme = ThemeNames.Jedi)
        {
            var scheme = Factory.GetStateColorSheme(theme);

            return(scheme.GetColor(color));
        }