I'm not sure how to approach this properly. I have main shell with regions. Everything as PRISM prescribes. I create Bootstrapper in App.xaml and run it.
What is a proper way to intercept main UI/Prism and Authenticate user? My application doesn't allow anonimous users.
EDIT: I found following article and this looks good but I'm not sure how module "depends on" works in开发者_如何转开发 this case. From what I understand - login module loads first but then it will load other modules doesn't matter if user logged in or not http://www.prismforsilverlight.com/2011/02/16/login-framework-with-mvvm-and-prism/
EDIT2:
My main question still remains. How do intercept shell and module loading with my custom login UI? I'm looking for best practice how it's done with PRISM. Article I mentioned in my EDIT 1 is just trying to solve same kind of issue.. It does mention SecurityService but it doesn't mention HOW login screen presented. And all the hooks/mechanics behind this process.
I'm not a Prism expert by any means, but I'm guessing that you would need to check the ISecurityService.IsLoggedOn property in the Initialize method of the dependent modules.
The relevant modules would still be downloaded, but they wouldn't inject themselves into the view unless the user was logged on. I'm not sure how you deal with the case where the download of the xaps finish and the user is still in the process of logging in, but I'm sure there is some way to reinitialize the modules once that happens.
ISecurityService.IsLoggedOn property won't be TRUE until user login successfully. And I think Module1's InitializationMode should be set as "OnDemand". Thus, when Module1's IModule.Initialize is called, it will first check if ISecurityService.IsLoggedOn == true. If not, then nothing will happen.
Hope this helps.
精彩评论