protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); System.Console.WriteLine("Hello,World!!"); // Dragablz Theme var mahTheme = ThemeManager.GetAppTheme(Settings.Default.ThemeColor); var mahAccent = ThemeManager.GetAccent(Settings.Default.AccentColor); ThemeManager.ChangeAppStyle(this, mahAccent, mahTheme); // Application Theme var radTheme = StyleConverter.FromMahTheme(mahTheme); var radAccent = StyleConverter.FromMahAccent(mahAccent); ThemeService.Current.Register(this, radTheme, radAccent); // Splash screen show #if !DEBUG new LoadingWindow().ShowDialog(); #else Nucleus.ReadConfig(); #endif ShutdownMode = ShutdownMode.OnMainWindowClose; /* * // style change https://mahapps.com/guides/styles.html * ThemeManager.AddAccent("Reseacher", new Uri("pack://application:,,,/Reseacher;component/ReseacherTheme.xaml")); * * Tuple<AppTheme, MahApps.Metro.Accent> theme = ThemeManager.DetectAppStyle(Current); * ThemeManager.ChangeAppStyle(Current, ThemeManager.GetAccent("Reseacher"), theme.Item1); */ }
protected override void DoChangeTheme(object sender) { var theme = ThemeManager.DetectAppStyle(Application.Current); var appTheme = ThemeManager.GetAppTheme(Name); ThemeManager.ChangeAppStyle(Application.Current, theme.Item2, appTheme); var metroTheme = StyleConverter.FromMahTheme(appTheme); ThemeService.Current.Register(Application.Current, metroTheme, ThemeService.Current.Accent); Settings.Default.AccentColor = theme.Item2.Name; Settings.Default.ThemeColor = appTheme.Name; Settings.Default.Save(); }
protected virtual void DoChangeTheme(object sender) { var theme = ThemeManager.DetectAppStyle(Application.Current); var accent = ThemeManager.GetAccent(Name); ThemeManager.ChangeAppStyle(Application.Current, accent, theme.Item1); try { var metroAccent = StyleConverter.FromMahAccent(accent); ThemeService.Current.Register(Application.Current, ThemeService.Current.Theme, metroAccent); } catch { /* ignore */ } Settings.Default.AccentColor = Name; Settings.Default.ThemeColor = theme.Item1.Name; Settings.Default.Save(); }