Permalink
Browse files

provide cancel during project close

  • Loading branch information...
cbries committed Dec 14, 2017
1 parent 987659c commit 7017c4c5c9ecc85a34a663fa0e2cd7ccb8adf51f
@@ -117,11 +117,33 @@ public static bool Ask(string promptMsg, string title, string yesText = "Yes", s
System.Windows.Style style = new System.Windows.Style();
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.YesButtonContentProperty, yesText));
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.NoButtonContentProperty, noText));
MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(promptMsg, title, MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes, style);
MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(promptMsg, title,
MessageBoxButton.YesNoCancel, MessageBoxImage.Warning, MessageBoxResult.Yes, style);
if (result == MessageBoxResult.Yes || result == MessageBoxResult.OK)
return true;
return false;
}
public static bool? AskWithCancel(string promptMsg, string title, string yesText = "Yes", string noText = "No")
{
System.Windows.Style style = new System.Windows.Style();
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.YesButtonContentProperty, yesText));
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.NoButtonContentProperty, noText));
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.CancelButtonContentProperty, "Cancel"));
MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(promptMsg, title,
MessageBoxButton.YesNoCancel, MessageBoxImage.Warning, MessageBoxResult.Yes, style);
if (result == MessageBoxResult.Cancel)
return null;
if (result == MessageBoxResult.Yes || result == MessageBoxResult.OK)
return true;
return false;
}
}
@@ -865,7 +865,7 @@
},
{
"objectId": 30003,
"name1": "hinten",
"name1": "",
"name2": null,
"name3": null,
"type": "ROUTE"
@@ -886,7 +886,7 @@
},
{
"objectId": 30011,
"name1": "vorne",
"name1": "",
"name2": null,
"name3": null,
"type": "ROUTE"
@@ -1170,6 +1170,13 @@ private void OnDataChanged(object sender)
public void Close(object o)
{
if (_project != null && IsDirty)
{
var rclose = Helper.AskWithCancel("Would you really like to close the project?", "Close project?");
if (rclose == null || !rclose.Value)
return;
}
if (_project != null)
{
TrackEntity.DisableEdit();
@@ -1198,6 +1205,7 @@ public void Close(object o)
{
var r = Helper.Ask("Project has been modified, save before close?",
"Project modified", "Save Project", "Discard Changes");
if (r)
Save(null);
}

0 comments on commit 7017c4c

Please sign in to comment.