MVVMCross programmatically change start ViewModel -


the portable class library defines start view model. scenario sounds great considering this. have written ios universal application or android needs change start screen / view model. if application phone, default view model login if tablet, want different view model start. there override or way take control of this?

see wiki section - https://github.com/mvvmcross/mvvmcross/wiki/customising-using-app-and-setup#custom-imvxappstart - has example of programmatic switching:


if more advanced startup logic needed, custom app start can used - e.g.

public class customappstart     : mvxnavigatingobject     , imvxappstart {     public void start(object hint = null)     {         var auth = mvx.resolve<iauth>();         if (auth.check())         {             showviewmodel<homeviewmodel>();         }         else         {             showviewmodel<loginviewmodel>();         }     } } 

this can registered in app using:

registerappstart(new customappstart()); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -