diff --git a/SourceGen/WpfGui/EditProjectProperties.xaml b/SourceGen/WpfGui/EditProjectProperties.xaml index a79b256..b99db63 100644 --- a/SourceGen/WpfGui/EditProjectProperties.xaml +++ b/SourceGen/WpfGui/EditProjectProperties.xaml @@ -25,7 +25,7 @@ limitations under the License. Title="Edit Project Properties" Width="640" Height="400" ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" - Loaded="Window_Loaded"> + Loaded="Window_Loaded" Closing="Window_Closing"> @@ -33,6 +33,9 @@ limitations under the License. + Some changes have not been applied. Discard them? + Discard Changes? + MOS 6502 WDC W65C02S diff --git a/SourceGen/WpfGui/EditProjectProperties.xaml.cs b/SourceGen/WpfGui/EditProjectProperties.xaml.cs index efb64d0..07cf2c7 100644 --- a/SourceGen/WpfGui/EditProjectProperties.xaml.cs +++ b/SourceGen/WpfGui/EditProjectProperties.xaml.cs @@ -149,6 +149,18 @@ namespace SourceGen.WpfGui { UpdateControls(); } + private void Window_Closing(object sender, CancelEventArgs e) { + if (IsDirty) { + string msg = (string)FindResource("str_ConfirmDiscardChanges"); + string caption = (string)FindResource("str_ConfirmDiscardChangesCaption"); + MessageBoxResult result = MessageBox.Show(msg, caption, MessageBoxButton.OKCancel, + MessageBoxImage.Question); + if (result == MessageBoxResult.Cancel) { + e.Cancel = true; + } + } + } + private void ApplyButton_Click(object sender, RoutedEventArgs e) { NewProps = new ProjectProperties(mWorkProps); IsDirty = false; @@ -160,6 +172,7 @@ namespace SourceGen.WpfGui { // insufficient. Might be best to just let the UndoableChange stuff figure out // that nothing changed. NewProps = new ProjectProperties(mWorkProps); + IsDirty = false; DialogResult = true; //GridView view = (GridView)projectSymbolsListView.View; diff --git a/SourceGen/WpfGui/MainWindow.xaml.cs b/SourceGen/WpfGui/MainWindow.xaml.cs index 509d2f0..97ced27 100644 --- a/SourceGen/WpfGui/MainWindow.xaml.cs +++ b/SourceGen/WpfGui/MainWindow.xaml.cs @@ -341,7 +341,6 @@ namespace SourceGen.WpfGui { } if (!mMainCtrl.WindowClosing()) { e.Cancel = true; - return; } }