/// <summary> /// Executes when the window is closed /// </summary> /// <param name="e">Event args</param> protected override void OnClosed(EventArgs e) { this.ApplySavedTheme(); IsRunning = false; CurrentRunningWindow = null; base.OnClosed(e); }
public PreferencesWindow() { InitializeComponent(); // Mention that the window is running IsRunning = true; PreferencesWindow.CurrentRunningWindow = this; this.WindowStartupLocation = WindowStartupLocation.CenterScreen; // Handle theme changing (Application.Current as App).ThemeChanged += (object obj, ThemeChangedEventArgs e) => { OrganicUtility.UpdateImages(this.mainLayout); }; Application.Current.Activated += (object obj, EventArgs e) => OrganicUtility.UpdateImages(this.mainLayout); // Fill the preferences from the usersettings file UserSettings settings = UserSettings.Load(); this.homePage.Value = settings.HomePage; this.newTabPage.Value = settings.NewTabPage; this.darkRadioButton.IsChecked = settings.Theme == Theme.Dark; this.lightRadioButton.IsChecked = settings.Theme == Theme.Light; this.autoRadioButton.IsChecked = settings.Theme == Theme.Auto; }