private void ChangeTheme(object parameter) { string name = (string)parameter; switch (name) { case "Generic": CurrentTheme = new GenericTheme(); break; case "Aero": CurrentTheme = new AeroTheme(); break; case "Metro": CurrentTheme = new MetroTheme(); break; case "VS2010": CurrentTheme = new VS2010Theme(); break; case "ExpressionDark": CurrentTheme = new ExpressionDarkTheme(); break; case "ExpressionLight": CurrentTheme = new ExpressionLightTheme(); break; } }
/// <inheritdoc/> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); AeroTheme.SetAsCurrentTheme(); IActivatedEventArgs?activationArgs = null; try { activationArgs = AppInstance.GetActivatedEventArgs(); } catch (System.Runtime.InteropServices.COMException) { activationArgs = null; } if (activationArgs != null) { switch (activationArgs.Kind) { case ActivationKind.Launch: this.MainWindow = new MainWindow(); break; case ActivationKind.File: var fileArgs = (FileActivatedEventArgs)activationArgs; if (fileArgs.Files.Count > 0) { this.MainWindow = new MainWindow(fileArgs.Files[0].Path); } else { this.MainWindow = new MainWindow(); } break; default: this.MainWindow = new MainWindow(); break; } } else { if (e != null && e.Args.Length > 0) { this.MainWindow = new MainWindow(e.Args[0]); } else { this.MainWindow = new MainWindow(); } } this.MainWindow.Show(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); const BindingFlags nonPublicStatic = BindingFlags.NonPublic | BindingFlags.Static; var PresentationFramework = typeof(ResourceDictionary).Assembly; var SystemResources_Type = PresentationFramework.GetType("System.Windows.SystemResources", true); SystemResources_ThemedDictionaryLoaded = SystemResources_Type?.GetField( "ThemedDictionaryLoaded", nonPublicStatic); SystemResources_ThemedDictionaryUnloaded = SystemResources_Type?.GetField( "ThemedDictionaryUnloaded", nonPublicStatic); ThemedDictionaryLoaded += OnThemedDictionaryLoaded; AeroTheme.SetAsCurrentTheme(); }
protected override void OnStartup(StartupEventArgs e) { Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture; base.OnStartup(e); ThemeManager.Install(); AeroTheme.SetAsCurrentTheme(); PopupEx.InstallHook(); var window = new MainWindow(); var viewModel = new MainWindowViewModel(window); mainWindowViewModel = viewModel; window.DataContext = viewModel; MainWindow = window; window.Show(); viewModel.Load().Forget(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); UseThemeManager = !e.Args.Contains("-tm:0"); UseAeroTheme = !e.Args.Contains("-aero:0"); var isEnableProperty = typeof(ResourceDictionaryDiagnostics).GetProperty( "IsEnabled", BindingFlags.NonPublic | BindingFlags.Static) ?? throw new InvalidOperationException("ResourceDictionaryDiagnostics.IsEnabled missing"); isEnableProperty.SetValue(null, true); ResourceDictionaryDiagnostics.ThemedResourceDictionaryLoaded += OnThemedDictionaryLoaded; if (UseThemeManager) { ThemeManager.Install(); } if (UseAeroTheme) { AeroTheme.SetAsCurrentTheme(); } }
public App() { AeroTheme.SetAsCurrentTheme(); }
/// <inheritdoc/> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); if (!CheckPackageIdentity()) { var page = new TaskDialogPage { AllowCancel = true, Title = "MSI Viewer", Instruction = "MSI Viewer cannot be run outside of its Windows Store package.", Icon = TaskDialogIcon.Get(TaskDialogStandardIcon.Error), }; page.StandardButtons.Add(TaskDialogResult.Close); var td = new TaskDialog(page); td.Show(); this.Shutdown(); return; } ThemeManager.Install(); AeroTheme.SetAsCurrentTheme(); IActivatedEventArgs?activationArgs = null; try { activationArgs = AppInstance.GetActivatedEventArgs(); } catch (System.Runtime.InteropServices.COMException) { activationArgs = null; } if (activationArgs != null) { switch (activationArgs.Kind) { case ActivationKind.Launch: this.MainWindow = new MainWindow(); break; case ActivationKind.File: var fileArgs = (FileActivatedEventArgs)activationArgs; if (fileArgs.Files.Count > 0) { this.MainWindow = new MainWindow(fileArgs.Files[0].Path); } else { this.MainWindow = new MainWindow(); } break; default: this.MainWindow = new MainWindow(); break; } } else { if (e != null && e.Args.Length > 0) { this.MainWindow = new MainWindow(e.Args[0]); } else { this.MainWindow = new MainWindow(); } } this.MainWindow.Show(); }
public App() { ThemeManager.Install(); AeroTheme.SetAsCurrentTheme(); }