Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 private void Discard_Click(object sender, RoutedEventArgs e)
 {
     SettingsInstance.DiscardEditAll();
     _clicked = true;
     Close();
     _clicked = false;
 }