I wanted to do some check, when I click the NavigateButton(Back) to home page. 1.Display the MessageDialog show update the content "yes" or "not" 2.If click yes, update current page. If click No, do nothing 3.navigate to homepage.
I use below code, but currently it will back to the home page first, and then pop up the message dialog. how can I let the action that navigate to homepage happened after I clicked the message dialog
protected async override void OnNavigatedFrom(NavigationEventArgs e)
{
MessageDialog md = new MessageDialog("Do you want to save");
md.Commands.Add(new UICommand("Yes", (UICommandInvokedHandler) =>
{
Application.Current.Exit();
//this.UpdateClick();
}));
md.Commands.Add(new UICommand("No"));
var task = md.ShowAsync().AsTask();
await task;
}