Beispiel #1
0
        public void SetTheme()
        {
            MaterialDesignThemes.Wpf.BundledTheme theme = new MaterialDesignThemes.Wpf.BundledTheme();
            theme.PrimaryColor   = MaterialDesignColors.PrimaryColor.Purple;
            theme.SecondaryColor = MaterialDesignColors.SecondaryColor.Lime;
            switch (GUIConfig.Instance.Theme)
            {
            case 0:
                if (AppsUseLightTheme)
                {
                    goto l;
                }
                goto d;

            case -1:
d:
                theme.BaseTheme = MaterialDesignThemes.Wpf.BaseTheme.Dark;
                break;

            case 1:
l:
                theme.BaseTheme = MaterialDesignThemes.Wpf.BaseTheme.Light;
                break;
            }

            Resources.MergedDictionaries.Add(theme);
        }
Beispiel #2
0
 private void SwitchTheme(object sender, RoutedEventArgs e)
 {
     Properties.Settings.Default.DarkTheme = DarkTheme.IsChecked ?? false;
     Properties.Settings.Default.Save();
     if (DarkTheme.IsChecked ?? false)
     {
         var dark = new MaterialDesignThemes.Wpf.BundledTheme
         {
             BaseTheme      = MaterialDesignThemes.Wpf.BaseTheme.Dark,
             PrimaryColor   = MaterialDesignColors.PrimaryColor.DeepPurple,
             SecondaryColor = MaterialDesignColors.SecondaryColor.Lime
         };
         System.Windows.Application.Current.Resources.MergedDictionaries.Add(dark);
     }
     else
     {
         var light = new MaterialDesignThemes.Wpf.BundledTheme
         {
             BaseTheme      = MaterialDesignThemes.Wpf.BaseTheme.Light,
             PrimaryColor   = MaterialDesignColors.PrimaryColor.DeepPurple,
             SecondaryColor = MaterialDesignColors.SecondaryColor.Lime
         };
         System.Windows.Application.Current.Resources.MergedDictionaries.Add(light);
     }
 }