If navigate back to the previous page, will the code resume where it left off?

I want to do something like this:

private async Task<KeyValuePair<string, string>> SelectAPlatypus()
{
    KeyValuePair<string, string> kvp;
    Frame.Navigate(typeof(DuckbillPage));
. . .

...and then have the code's execution continue where the ellipsis dots are after the user navigates back from the DuckbillPage. Will this work? Or after leaving a page in this way does a return to it take you back to the NavigatedTo() event only, and not return to the prior code?

If so, is creating an in-page Popup-like dialog a a viable/feasible option (as opposed to navigating to a different page)?

I know I can check for a condition or variable state in the original page's NavigatedTo() event, but I don't want to get any more "clever" than I have to. I'm trying to avoid making a batch of Rube Goldberg spaghetti.

Upvotes: 0

Views: 151

Answers (1)

Caleb Keith
Caleb Keith

Reputation: 816

The rest of the method will execute regardless if the Frame navigates. You can write a Modal Dialog to show instead of navigating.

Using a task as the Show() method for the Modal Dialog, you could pause code execution and wait for the dialog to close before executing the rest of the method.

Upvotes: 1

Related Questions