Login page before shell
-
Friday, March 23, 2012 4:52 AM
I am developing a SL4 app by applying PRISM and MVVM pattern. I'd want to make users authenticate with username and password credentials before loading the shell (a common scenario), but I am not able to do
Any help appreciated
All Replies
-
Sunday, March 25, 2012 10:21 AM
gioasl
You can have multiple Shell(Container) forward form one to other one. However there should be only App Root for Silvelright.
-
Monday, March 26, 2012 2:35 AM
Ok thank you for your answer I will now try to implement this approach and let you know
-
Monday, March 26, 2012 3:48 AM
Thank you thaicarrot
I have implemented this approach and it worked greatly for me, if everyone will be interested in details I can provide them in future
-
Thursday, April 19, 2012 5:46 AM
Hi
pls URGENT
I detected the same problem, I need to run login screen before the shell
Could you pls send me the code, in order to run in the Bootstrapper two shells?
Thanks in advance -
Friday, April 20, 2012 4:03 PM
Hello, I will explain how it works
So I created the one shell called ShellRoot with just one region called "ShellRootRegion".
In "CreateShell" method of bootstrapper I am initiating this ShellRoot:
protected override DependencyObject CreateShell() { return ServiceLocator.Current.GetInstance<ShellRoot>(); }My Security module registers the login view for region ShellRootRegion, and this module is downloaded with application, so when it is initiated it injects the login view in ShellRoot view:
SecurityModule -> Initialize() { ..... IRegionManager regionManager = ServiceLocator.Current.GetInstance<IRegionManager>(); regionManager.RequestNavigate(RegionName.ShellRootRegion, new Uri(ViewNames.LoginView, UriKind.Relative)); }after the user types login credentials, login view executes login command, callback of which (if authentication succeedes) requests navigation to my real Shell view, which in turn defines other real regions for real UI views:
auth.Authentication.Login(new LoginParameters(UserName, Password), lo => { if (lo.LoginSuccess) { IRegionManager regionManager = ServiceLocator.Current.GetInstance<IRegionManager>(); regionManager.RequestNavigate(RegionName.ShellRootRegion, new Uri(ViewNames.ShellView, UriKind.Relative)); } else LoginFailText = "........"; }, null);RegionName.ShellRootRegion and ViewNames.ShellView are just predefined constants
Best Regards
----------------------------------------------------------------------------------------------------------------
Please Mark as answered if my post helped.
-
Sunday, April 22, 2012 7:14 AM
thank about your help
Do you work with 2 modules: authentication module and another module?
and which module does ShellView belong? -
Thursday, April 26, 2012 7:50 AM
Shell always belongs to main project, where bootstrapper resides.
Please mark above post as Answered if it helped you, I'm new here and don't mind to make some points :))
-
Sunday, April 29, 2012 4:03 PM
Sure. Your answer helped me
But I want to understand your answer well
Is the login screen in a separate module or part of the main project? -
Tuesday, May 01, 2012 7:36 AM
Thank you again. But I don't see an option to mark your answer. maybe I have no enough points for this :(
-
Wednesday, May 02, 2012 2:31 AM
Login Screen is in separete module and is registered via it's initialize method, as demonstrated in code
-
Thursday, May 03, 2012 2:05 AM
I think there is a loose coupling
Why does Authentication module call to screen that belongs to another module?? -
Tuesday, May 08, 2012 2:29 AM
Authentication module calls login screen that belongs to Authentication module itself

