I’m working on a project which uses PRISM 4 and the MVVM pattern.
The project requires that a login screen appears at start-up, allowing users to login and, in the event that the login is successful, select a project from a list. That selection could be done within the boundaries of the Login window, but all controls would need to be replaced.
I created the Login screen as a Window which is displayed in the Shell’s constructor. This allows me to display it prior to the Shell while still making the Shell the main window of the application.
The problem is that I need to display the Project selection controls within the Login window and I’m not sure exactly how I should go about hiding controls / displaying new ones within a view while still using the MVVM and PRISM guidelines.
Another solution would be to have two shells, one of them being used to display two different views (i.e.: the Login and Project selection views) while the other would be the “Main” shell of the application.
If I decide to use two shells, both the Login and Project selection screens would be separated in two views and I will not have to toy around with controls visibility. But then again, I’m not sure how exactly to implement that.
How would you recommend that I proceed ?
I actually just created another “Login” shell which is displayed prior to the “Main” shell.
The “Login” shell now hosts the “Credentials Input” and “Project Selection” views. The user can navigate from the “Credentials Input” View to the “Project Selection” View if his credentials are valid.
Likewise, the user may go back to the “Credentials Input” View from within the “Project Selection” View using the Navigation Journal functionality in PRISM.
Following a Project Selection, the “Login Shell” is hidden and the “Main” Shell is displayed.