예제 #1
0
        public void IsLightThemeTrue1()
        {
            var target = AppTheme.GenerateDarkTheme();
            var actual = target.IsLightTheme;

            Assert.False(actual);
        }
        public PreferencesWindowViewModel()
        {
            LoadedCommand = new ReactiveCommand();
            LoadedCommand.Subscribe(LoadedAction);

            DelimiterDefaultCommand = new ReactiveCommand();
            DelimiterDefaultCommand.Subscribe(DelimiterDefaultAction);

            SaveCommand = new ReactiveCommand();
            SaveCommand.Subscribe(SaveAction);

            SelectionChangedCommand = new ReactiveCommand();
            SelectionChangedCommand.Subscribe(SelectionChangedAction);

            ClosedCommand = new ReactiveCommand();
            ClosedCommand.Subscribe(ClosedAction);

            ModifierKey1 = new ReactiveCollection <ModifierKeys>
            {
                ModifierKeys.None,
                ModifierKeys.Alt,
                ModifierKeys.Control,
                ModifierKeys.Shift
            };

            ModifierKey2 = new ReactiveCollection <ModifierKeys>
            {
                ModifierKeys.None,
                ModifierKeys.Alt,
                ModifierKeys.Control,
                ModifierKeys.Shift
            };

            Keys = new ReactiveCollection <Key>()
            {
                Key.None,
                Key.Space
            };

            ThemeNames = new ReactiveCollection <string>
            {
                AppTheme.GenerateDarkTheme().ThemeName,
                                             AppTheme.GenerateLightTheme().ThemeName
            };
        }
예제 #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);
        }
예제 #4
0
        public void SaveTrue1()
        {
            var path = "SaveTrue1.json";

            if (File.Exists(path))
            {
                File.Delete(path);
            }

            var runRegisterMoq = new Mock <IRunRegister>();

            runRegisterMoq.Setup(x => x.RegistKey(true));

            var target = new PreferencesRepository(path)
            {
                JsonSerializer = jsonSerializer,
                RunRegister    = runRegisterMoq.Object
            };

            target.New();

            var preferences = new Preferences(":", new GlobalShortcut(ModifierKeys.Alt, Key.S), AppTheme.GenerateDarkTheme().ThemeName, true);

            target.Save(preferences);

            Assert.True(File.Exists(path));
            var actual = target.All();

            Assert.Equal(1, actual.Version);
            Assert.Equal(":", actual.Delimiter);
            Assert.NotStrictEqual(new GlobalShortcut(ModifierKeys.Alt, Key.S), actual.ShowHideShortcut);
            Assert.Equal("Dark.Steel", actual.ThemeName);
            Assert.True(actual.AutoLaunch);
        }