Why I want to exit the silverlight Phone app

This is with a link to close the Windows Phone 7 application

What if I have page-A β†’ Page-B (i.e. Page-A allowijg navigation to Page-B) On page-B, I have certain controls that lead me to page-C, page- D, Page- E, Page-F, etc.

If I am on page-F by pressing the back key, I want the user to reach Page A (So, I am redefining OnBackKeyPressed). Now, when on page-A, if the user presses the back-key again, he is again transferred to Page-B

So, I can’t exit the application when the user presses the back key on page A, and he is stuck between the pages and Page-B by pressing

This is not consistent with user experience.

From the discussion, I understand that in silverlight there is no (correct) way to exit the application. So, I am developing the application incorrectly, where I have many auxiliary pages to display, but I would like the user to reach one of the main pages by overriding the rear key.

+4
source share
3 answers

If I understand correctly, that you are faced with a problem with circular navigation. In other words, you want the application to exit when you reach "Page-A." In this case, you should definitely check out this recipe from Microsoft for working with circular navigation:

Circular navigation solution

Another use would be to use pop-ups rather than creating new pages for the user to navigate, so you don’t have to worry about accessing the stack.

See Creating a custom popup in WP7 .

Let me know if this helps.

+1
source

The only thing you can do is, instead of overriding OnBackKeyPressed on page F, overriding the OnNavigatedTo method on page B to go another page through the stack to page A. This way you will naturally move along the stack. As you find out, if you redefine the return key once to redirect someone, there is a good chance that you will have to do this every time.

The only problem with this solution is that WP7 has no easy way to find out where you came from. What I do is that every time I go to a new page, I cache the URI of the page that I leave.

+4
source

See Nonlinear Navigation Service ; it is designed to solve circular navigation issues similar to what you seem to have.

Without knowing the details of what you are trying to achieve, it is difficult to propose an alternative, but perhaps you should think about the design of your application to see if navigation from page F to page A by pressing the back key should be avoided.

Finding out why you think this is necessary may allow others to suggest alternative implementations.

+2
source

Source: https://habr.com/ru/post/1345583/


All Articles