Windows Phone 7, MVVM, Silverlight and navigation best practice / patterns and strategies
- by Matt F
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