When should the ViewModels call Services and Isolatedstorage
I'm using the MVVM-Light toolkit and storing my ViewModelLocator in App.Resources. I noticed that my ViewModelLocator class gets created before the Application_Launching event gets fired, and according to this Link from Microsoft you shouldn't make any Network calls or access Isolated Storage until after the Application_Loading event has fired and the application is loaded.
开发者_JAVA百科So my problem is that my ViewModelLocator creates my ViewModels in its constructor and the ViewModels in turn are making Service calls and accessing IsolatedStorage. So how are you suppose to do this properly? And how do I wait for the app to be "Loaded" when there is no Application_Loaded event?
My understanding is if the load calls are asynchronous, it meets your requirments.
Otherwise, you can always implement your own flag system/ delayed delegate calls after load event completes.
精彩评论