Ejemplo n.º 1
0
        private void ChangeAccentColor(object sender, RoutedEventArgs e)
        {
            var         clicked     = e.OriginalSource as MenuItem;
            ColorScheme colorScheme = clicked.DataContext as ColorScheme;

            ThemeManager.ChangeThemeColorScheme(Application.Current, colorScheme.Name);
        }
Ejemplo n.º 2
0
        private void ChangeThemeStyle(object sender, System.Windows.RoutedEventArgs e)
        {
            Tile tt = sender as Tile;

            HettyTools.Properties.Settings.Default.Accent = tt.Tag.ToString();
            HettyTools.Properties.Settings.Default.Save();
            ThemeManager.ChangeThemeColorScheme(Application.Current, tt.Tag.ToString());
        }
Ejemplo n.º 3
0
 private void AccentSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     var selectedAccent = AccentSelector.SelectedItem as ColorScheme;
     if (selectedAccent != null)
     {
         ThemeManager.ChangeThemeColorScheme(Application.Current, selectedAccent.Name);
         Application.Current?.MainWindow?.Activate();
     }
 }
Ejemplo n.º 4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            SoftwareMutex.RunMutext();
            GlobalData.Init();

            #region 皮肤和样式载入

            if (!string.IsNullOrEmpty(GlobalData.AppConfig.ColorSchemeName))
            {
                ThemeManager.ChangeThemeColorScheme(this, GlobalData.AppConfig.ColorSchemeName);
            }
            if (!string.IsNullOrEmpty(GlobalData.AppConfig.ThemeName))
            {
                ThemeManager.ChangeThemeBaseColor(this, GlobalData.AppConfig.ThemeName);
            }

            #endregion

            base.OnStartup(e);
        }
Ejemplo n.º 5
0
        public void ChangeColorScheme()
        {
            {
                var currentTheme = ThemeManager.DetectTheme(Application.Current);

                Assert.That(currentTheme, Is.Not.Null);
                ThemeManager.ChangeThemeColorScheme(Application.Current, "Yellow");

                Assert.That(ThemeManager.DetectTheme(Application.Current).BaseColorScheme, Is.EqualTo(currentTheme.BaseColorScheme));
                Assert.That(ThemeManager.DetectTheme(Application.Current).ColorScheme, Is.EqualTo("Yellow"));
            }

            {
                using (var window = new TestRibbonWindow())
                {
                    var currentTheme = ThemeManager.DetectTheme(window);

                    Assert.That(currentTheme, Is.Not.Null);
                    ThemeManager.ChangeThemeColorScheme(window, "Green");

                    Assert.That(ThemeManager.DetectTheme(window).BaseColorScheme, Is.EqualTo(currentTheme.BaseColorScheme));
                    Assert.That(ThemeManager.DetectTheme(window).ColorScheme, Is.EqualTo("Green"));
                }
            }

            {
                var currentTheme = ThemeManager.DetectTheme(Application.Current);

                Assert.That(currentTheme, Is.Not.Null);

                var control = new Control();
                ThemeManager.ChangeThemeColorScheme(control.Resources, currentTheme, "Red");

                Assert.That(ThemeManager.DetectTheme(control.Resources).BaseColorScheme, Is.EqualTo(currentTheme.BaseColorScheme));
                Assert.That(ThemeManager.DetectTheme(control.Resources).ColorScheme, Is.EqualTo("Red"));
            }

            Assert.That(ThemeManager.DetectTheme(Application.Current).ColorScheme, Is.EqualTo("Yellow"));
        }
Ejemplo n.º 6
0
 protected virtual void DoChangeTheme()
 {
     ThemeManager.ChangeThemeColorScheme(Application.Current, this.Name);
     GlobalData.AppConfig.ColorSchemeName = this.Name;
     GlobalData.Save();
 }
Ejemplo n.º 7
0
 private void ChangeAppAccentButtonClick(object sender, RoutedEventArgs e)
 {
     ThemeManager.ChangeThemeColorScheme(Application.Current, ((Button) sender).Content.ToString());
     Application.Current?.MainWindow?.Activate();
 }
Ejemplo n.º 8
0
 private void ChangeWindowAccentButtonClick(object sender, RoutedEventArgs e)
 {
     ThemeManager.ChangeThemeColorScheme(this, ((Button) sender).Content.ToString());
 }
Ejemplo n.º 9
0
 public void ApplyColorScheme(string baseColorName, ColorScheme colorScheme)
 {
     ThemeManager.ChangeThemeBaseColor(Application.Current, baseColorName);
     ThemeManager.ChangeThemeColorScheme(Application.Current, colorScheme.Name);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Change the Accent color
 /// </summary>
 protected virtual void DoChangeTheme()
 {
     ThemeManager.ChangeThemeColorScheme(Application.Current, this.Name);
 }
 internal void SetTheme(string themeAccent, string themeBase = "BaseDark")
 {
     ThemeManager.ChangeThemeColorScheme(Application.Current, themeAccent);
 }