The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

clear back cache

Last post 09-23-2008, 5:27 AM by mjp14. 3 replies.
Sort Posts: Previous Next
  •  09-22-2008, 9:57 AM 8400

    clear back cache

    If an Addin has two screens A(main UI) and B (settings UI), how can you eliminate the user pressing the back button (or mouse clicking the back button) from A and go back to B?  That is, I only want access to B from a button on A, effectively stopping the following behaviour with the back button..

    A --> (click settings) B --> (click save) A --> B (click Back)

    I know you can intercept the Back button but what about the mouse pressing of the back button.  I know that cannot be intercepted.  Is there a way to clear pages out of the back cache?

  •  09-22-2008, 8:35 PM 8404 in reply to 8400

    Re: clear back cache

    you can use a PageSession instead of a HistoryOrientedPageSession but that has its own issues
  •  09-22-2008, 11:38 PM 8405 in reply to 8400

    Re: clear back cache

    If I understand correctly, what you are looking for is not to stop the user from pressing the back button, but to stop them from pressing "back" from A and seeing the settings they saved in page B?

    If this is correct, there are two ways you could achieve this - first and easiest is to not navigate from B back to A, simply use the BackPage method on the HistoryOrientedPageSession after you've saved the settings changes.  This will take B off the stack just as pressing back would.

    If you have more than one page in your settings, then you can override one of the GoToPage methods on the HistoryOrientedPageSession by creating a new class and inheriting from HistoryOrientedPageSession.  This then exposes an override with a boolean value for "add to stack" - set this to false and the page you navigate from doesn't get put on the stack.  Use this to navigate from B to A and B will never get put on the stack, so can't be navigated back to. See the Q sample app in the SDK for implementation details.

    Cheers,
    Andrew

  •  09-23-2008, 5:27 AM 8409 in reply to 8405

    Re: clear back cache

    Exactly what I was looking for, thanks.  I only have one page in my settings the easier option should be sufficient.
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems