Windows Phone 7, MVVM, Silverlight and navigation best practice / patterns and strategies

Posted by Matt F on Stack Overflow See other posts from Stack Overflow or by Matt F
Published on 2010-04-30T20:07:10Z Indexed on 2010/05/01 13:27 UTC
Read the original article Hit count: 342

Whilst building a Windows Phone 7 app. using the MVVM pattern we've struggled to get to grips with a pattern or technique to centralise navigation logic that will fit with MVVM.

To give an example, everytime the app. calls our web service we check that the logon token we've assigned the app. earlier hasn't expired. We always return some status to the phone from the web service and one of those might be Enum.AuthenticationExpired.

If we receive that I'd imagine we'd alert the user and navigate back to the login screen. (this is one of many examples of status we might receive)

Now, wanting to keep things DRY, that sort of logic feels like it should be in one place. Therein lies my question.

How should I go about modelling navigation that relies on (essentially) switch or if statements to tell us where to navigate to next without repeating that in every view.

Are there recognised patterns or techniques that someone could recommend?

Thanks

© Stack Overflow or respective owner

Related posts about windows-phone-7

Related posts about mvvm