Ignorable navigation pages

Sep 3, 2012 at 8:53 AM

I think it'd be useful to have a way which we could ignore pages from navigation. For example, a login page, this you wouldn't want to be something that you could "go back" to and you also wouldn't want it to indicate that you could go back.

I'm thinking you could do it by:

  • Have a property on the PageExport, bool IgnoreBackNavigation
  • When that is set to true it doesn't do the navigationStack.Push in the Navigation Manager

The default behaviour of this would be 'false' so it's an opt-in not an opt-out feature.

Coordinator
Sep 3, 2012 at 1:14 PM

Sounds a good feature request. Implementation might be a little more complex as PageExport is a Okra.MEF specific attribute, whilst the navigation manager is IoC idependent but I'll look into it.

Thanks for the feedback,

    Andy

Sep 3, 2012 at 11:42 PM

Yeah I went digging around the code and realised that that solution might not be ideal.

The other idea was to have an attribute that is looked for, [IgnoreBackNavigation] for example and then it's decoupled from the MEF stuff.

Sep 4, 2012 at 1:40 AM

Started the idea in a fork - http://okra.codeplex.com/SourceControl/network/forks/slace/ignorablenavigation

Added some tests (but one fails as the current page concept is now not so happy)

Coordinator
Sep 11, 2012 at 9:40 PM

Hi...

Had a look at your fork. I like the idea of being able to attribute the page to determine if this should be ignored in the navigation stack. I would also like to be able to allow programatic access to this feature is desired (maybe an ignore back navigation parameter on navigation away from the page?). Also it would be ideal to be able to support multiple pages to be ignored - for example a shopping cart experience where the user can navigate back through the process, but all pages would be purged when the checkout operation was complete. Might be via another mechanism however.

Andy

Sep 17, 2012 at 2:20 AM

Yeah that shopping cart would be a good idea, being able to remove X number of history events. Maybe if the purge method was exposed that took a delegate and you could something like:

navigationManager.Purge(entry => entry.Name.Contains("ShoppingCart"));

As for being able to programmatically decide if you can/ can't go back to a page I'm not sure if it's a good idea. I can't think of a scenario where that would be a better feature than attributing the View. Under what scenario would you want to decide if you could/ couldn't go back?

Coordinator
Oct 1, 2012 at 1:01 PM

Finally catching up with post holiday backlog...

Something like a Purge(...) method would be my preference for this (although I'm still unsure about naming).

It would be worth mentioning for the moment that if you want to ignore a page from the navigation stack then you should be able to do this by calling GoBack() just before navigating to the next page - should have the same effect.

I've got this feature on my todo list at the moment, but don't expect anything here too soon!

Regards,

    Andy