Example #1
0
        public void LoadTheme()
        {
            var currentTheme     = GetCurrentTheme();
            var currentThemeName = currentTheme.ThemeName ?? AppTheme.GenerateDefault().ThemeName;

            ThemeManager.ChangeTheme(Application.Current, currentThemeName);
        }
Example #2
0
        public void PreferencesTrue1()
        {
            var globalShortcut = new GlobalShortcut(System.Windows.Input.ModifierKeys.None, System.Windows.Input.Key.A);
            var actual         = new Preferences(",", globalShortcut, AppTheme.GenerateDefault().ThemeName, true);

            Assert.NotNull(actual);
            Assert.Equal(nowVersion, actual.Version);
            Assert.Equal(",", actual.Delimiter);
            Assert.Equal(globalShortcut, actual.ShowHideShortcut);
            Assert.Equal("Dark.Steel", actual.ThemeName);
            Assert.True(actual.AutoLaunch);
        }
Example #3
0
        public AppTheme SwitchTheme()
        {
            var currentTheme = GetCurrentTheme();

            var theme = AppTheme.GenerateDefault();

            if (currentTheme.IsDarkTheme)
            {
                theme = AppTheme.GenerateLightTheme();
            }
            if (currentTheme.IsLightTheme)
            {
                theme = AppTheme.GenerateDarkTheme();
            }
            ThemeManager.ChangeTheme(Application.Current, theme.ThemeName);

            return(theme);
        }
        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;
        }
Example #5
0
        public AppTheme GetCurrentTheme()
        {
            var currentThemeName = PreferencesService?.GetPreferences()?.ThemeName;

            return(AppTheme.GenerateNew(currentThemeName ?? AppTheme.GenerateDefault().ThemeName));
        }