don't display the confirm exit dialog twice
This commit is contained in:
parent
de321a3e39
commit
1221a7aacc
@ -194,7 +194,7 @@ namespace UniversalEditor.UserInterface
|
||||
MainWindow mw = (Application.Windows[i] as MainWindow);
|
||||
if (mw == null) continue;
|
||||
|
||||
if (!mw.ConfirmExit())
|
||||
if (!mw.Close())
|
||||
{
|
||||
e.Cancel = true;
|
||||
break;
|
||||
|
||||
@ -704,14 +704,27 @@ namespace UniversalEditor.UserInterface
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool _UserClosed = false;
|
||||
protected override void OnClosing(WindowClosingEventArgs e)
|
||||
{
|
||||
base.OnClosing(e);
|
||||
|
||||
if (e.CloseReason == WindowCloseReason.UserClosing)
|
||||
if (e.CloseReason == WindowCloseReason.UserClosing || e.CloseReason == WindowCloseReason.ApplicationStop)
|
||||
{
|
||||
if (e.CloseReason == WindowCloseReason.UserClosing)
|
||||
{
|
||||
_UserClosed = true;
|
||||
}
|
||||
else if (e.CloseReason == WindowCloseReason.ApplicationStop && _UserClosed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!ConfirmExit())
|
||||
{
|
||||
_UserClosed = false;
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user