Skip to content

Commit

Permalink
Closing main demo was wrong (TaskCanceledException)
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Jan 16, 2018
1 parent 3c2a9e2 commit 9071379
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ private async void CleanWindowClosing(object sender, System.ComponentModel.Cance
AnimateHide = false
};
var result = await this.ShowMessageAsync(
"Quit application?",
"Sure you want to quit application?",
"Quit window?",
"Sure you want to quit this clean demo?",
MessageDialogStyle.AffirmativeAndNegative, mySettings);

this.closeMe = result == MessageDialogResult.Affirmative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,26 +368,35 @@ private void LaunchNavigationDemo(object sender, RoutedEventArgs e)

private async void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (e.Cancel) return;
if (e.Cancel)
{
return;
}

e.Cancel = !_shutdown && _viewModel.QuitConfirmationEnabled;
if (_shutdown) return;
if (!e.Cancel)
{
return;
}

var mySettings = new MetroDialogSettings()
{
AffirmativeButtonText = "Quit",
NegativeButtonText = "Cancel",
AnimateShow = true,
AnimateHide = false
};
{
AffirmativeButtonText = "Quit",
NegativeButtonText = "Cancel",
AnimateShow = true,
AnimateHide = false
};

var result = await this.ShowMessageAsync("Quit application?",
"Sure you want to quit application?",
MessageDialogStyle.AffirmativeAndNegative, mySettings);
"Sure you want to quit application?",
MessageDialogStyle.AffirmativeAndNegative, mySettings);

_shutdown = result == MessageDialogResult.Affirmative;

if (_shutdown)
{
Application.Current.Shutdown();
}
}

private MetroWindow testWindow;
Expand Down

0 comments on commit 9071379

Please sign in to comment.