private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (_detailedInfoWindow != null) { _detailedInfoWindow.Close(); } if (_historyWindow != null) { _historyWindow.Close(); } Properties.Settings setting = App.Current.Resources["SettingsDataSource"] as Properties.Settings; if (setting != null) { setting.Save(); } }
private void BackgroundColorMenuItem_Click(object sender, System.Windows.RoutedEventArgs e) { Properties.Settings setting = App.Current.Resources["SettingsDataSource"] as Properties.Settings; Microsoft.Samples.CustomControls.ColorPickerDialog dialog = new Microsoft.Samples.CustomControls.ColorPickerDialog(); if (setting != null) { dialog.StartingColor = setting.backgroundColor.Color; } dialog.ShowDialog(); bool?ret = dialog.DialogResult; if (ret.HasValue && ret.Value == true) { if (setting != null) { setting.backgroundColor = new SolidColorBrush(dialog.SelectedColor); this.UpdateLayout(); } } }