Пример #1
0
 public CustomTextBox()
 {
     TextWrapping  = TextWrapping.Wrap;
     AcceptsTab    = true;
     AcceptsReturn = true;
     ResourceLocator.SetColorScheme(Application.Current.Resources, ResourceLocator.DarkColorScheme);
 }
Пример #2
0
 private void ChangeTheme()
 {
     this.Dispatcher.Invoke(() =>
     {
         // Get system app theme and set app theme based on values
         RegistryKey reg = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize");
         if (int.TryParse(reg.GetValue("AppsUseLightTheme").ToString(), out int result))
         {
             Log.Information("Got selected theme from user, applying.");
             if (result == 0)
             {
                 Log.Information("Applying dark mode.");
                 TitleBarBackground = System.Windows.Media.Brushes.Black;
                 ResourceLocator.SetColorScheme(Application.Current.Resources, ResourceLocator.DarkColorScheme);
             }
             else
             {
                 Log.Information("Applying light mode.");
                 TitleBarBackground = System.Windows.Media.Brushes.White;
                 ResourceLocator.SetColorScheme(Application.Current.Resources, ResourceLocator.LightColorScheme);
             }
         }
         reg.Close();
         reg.Dispose();
     });
 }
Пример #3
0
        private void ChangeTheme(object sender, RoutedEventArgs e)
        {
            Uri myTheme = new Uri("pack://application:,,,/pocgen;component/TheRealDarkTheme.xaml", UriKind.Absolute);

            ResourceLocator.SetColorScheme(Application.Current.Resources, _isDark ? ResourceLocator.DarkColorScheme : myTheme);
            _isDark = !_isDark;
        }
Пример #4
0
        private void SetThemeFromSettings()
        {
            var useDarkTheme = settingsManager.UseDarkTheme;

            var themeToUse = useDarkTheme ? ResourceLocator.DarkColorScheme : ResourceLocator.LightColorScheme;

            ResourceLocator.SetColorScheme(Application.Current.Resources, themeToUse);
        }
Пример #5
0
        public MainWindow()
        {
            InitializeComponent();
            checkForTime.Elapsed += new ElapsedEventHandler(checkForTime_Elapsed);
            checkForTime.Enabled  = true;

            ResourceLocator.SetColorScheme(Application.Current.Resources, Settings1.Default.IsDark ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);
        }
Пример #6
0
 public void UpdateColorTheme(bool darkMode)
 {
     ResourceLocator.SetColorScheme(this.Resources, !darkMode ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);
     ResourceLocator.SetColorScheme(SettingsWindow.Resources, !darkMode ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);
     if (AboutWindow != null)
     {
         ResourceLocator.SetColorScheme(AboutWindow.Resources, !darkMode ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);
     }
 }
        public void ChangeColourScheme(bool isLight)
        {
            System.Uri colourScheme = isLight ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme;
            ResourceLocator.SetColorScheme(Application.Current.Resources, colourScheme);

            if (simpleConfigPage != null)
            {
                simpleConfigPage.ChangeScheme(colourScheme);
            }
        }
Пример #8
0
        public MainWindow()
        {
            InitializeComponent();

            _isDark = (bool)Properties.Settings.Default["darkmode"];
            ToggleButton button = DarkModeToggleButton;

            button.Content = _isDark ? "Off" : "On";
            ResourceLocator.SetColorScheme(Application.Current.Resources, _isDark ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);
        }
Пример #9
0
 private static void ChangeTheme(Uri theme)
 {
     if (theme == ResourceLocator.DarkColorScheme)
     {
         ResourceLocator.SetColorScheme(Current.Resources, ResourceLocator.DarkColorScheme, ResourceLocator.LightColorScheme);
     }
     else
     {
         ResourceLocator.SetColorScheme(Current.Resources, ResourceLocator.LightColorScheme, ResourceLocator.DarkColorScheme);
     }
 }
Пример #10
0
        private void DarkModeToggleButton_OnClick(object sender, RoutedEventArgs e)
        {
            ToggleButton button = (ToggleButton)sender;

            button.Content = _isDark ? "Off" : "On";

            ResourceLocator.SetColorScheme(Application.Current.Resources, _isDark ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);

            _isDark = !_isDark;
            Properties.Settings.Default["darkmode"] = _isDark;
            Properties.Settings.Default.Save();
        }
Пример #11
0
 private void ChangeTheme(object sender, RoutedEventArgs e)
 {
     ResourceLocator.SetColorScheme(Application.Current.Resources, _isDark ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);
     _isDark = !_isDark;
     if (_isDark)
     {
         this.TextBox.Background = (Brush)(new BrushConverter().ConvertFrom("#FF3F3F4D"));
     }
     else
     {
         this.TextBox.Background = (Brush)(new BrushConverter().ConvertFrom("#FFEDEDED"));
     }
 }
Пример #12
0
        /// <summary>
        /// AdonisUI concrete implementation for color scheme setting
        /// </summary>
        /// <param name="appColorScheme"></param>
        public void SetColorScheme(AppColorScheme appColorScheme)
        {
            switch (appColorScheme)
            {
            case AppColorScheme.Dark:
                ResourceLocator.SetColorScheme(System.Windows.Application.Current.Resources, ResourceLocator.DarkColorScheme);
                break;

            case AppColorScheme.Light:
                ResourceLocator.SetColorScheme(System.Windows.Application.Current.Resources, ResourceLocator.LightColorScheme);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(appColorScheme), appColorScheme, null);
            }
        }
Пример #13
0
        public void ChangeTheme()
        {
            Uri DarkColorScheme  = new Uri("pack://application:,,,/ZenTimings;component/Themes/Dark.xaml", UriKind.Absolute);
            Uri LightColorScheme = new Uri("pack://application:,,,/ZenTimings;component/Themes/Light.xaml", UriKind.Absolute);

            if (DarkMode)
            {
                ResourceLocator.SetColorScheme(Application.Current.Resources, DarkColorScheme);
            }
            else
            {
                ResourceLocator.SetColorScheme(Application.Current.Resources, LightColorScheme);
            }

            //DarkMode = !DarkMode;
        }
Пример #14
0
        public void SetColorScheme(Theme colorTheme)
        {
            AccentColorScheme accentColorScheme;
            Uri colorScheme;

            switch (colorTheme)
            {
            case Theme.Dark:
                accentColorScheme = DarkRed;
                colorScheme       = ResourceLocator.DarkColorScheme;
                break;

            default:
                accentColorScheme = LightRed;
                colorScheme       = ResourceLocator.LightColorScheme;
                break;
            }
            accentColorScheme.ApplyColors(Application.Current.Resources);
            ResourceLocator.SetColorScheme(Application.Current.Resources, colorScheme);
        }
Пример #15
0
 private void IsDark_Click(object sender, RoutedEventArgs e)
 {
     Settings1.Default.IsDark = !(bool)IsDark.IsChecked;
     ResourceLocator.SetColorScheme(Application.Current.Resources, Settings1.Default.IsDark ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);
 }
Пример #16
0
 public MainWindow()
 {
     DataContext = new ApplicationViewModel();
     InitializeComponent();
     ResourceLocator.SetColorScheme(Application.Current.Resources, ResourceLocator.DarkColorScheme);
 }
Пример #17
0
        private void ChangeTheme(object sender, RoutedEventArgs e)
        {
            ResourceLocator.SetColorScheme(Application.Current.Resources, _isDark ? ResourceLocator.LightColorScheme : ResourceLocator.DarkColorScheme);

            _isDark = !_isDark;
        }