private void Window_Closing(object sender, CancelEventArgs e) { if (!_clicked && IsVisible) { var r = MessageBox.Show("Save changes?", "Sky Jukebox Settings", _close ? MessageBoxButton.YesNo : MessageBoxButton.YesNoCancel, MessageBoxImage.Question, _close ? MessageBoxResult.No : MessageBoxResult.Cancel); switch (r) { case MessageBoxResult.Cancel: e.Cancel = true; return; case MessageBoxResult.No: SettingsInstance.DiscardEditAll(); break; case MessageBoxResult.Yes: SettingsInstance.SaveEditAll(); break; } } if (_close) { return; } e.Cancel = true; Hide(); }
private void Save_Click(object sender, RoutedEventArgs e) { SettingsInstance.SaveEditAll(); _clicked = true; Close(); _clicked = false; }