Click here to Skip to main content
15,887,432 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: How do I load a UI based on a user specific role Pin
phyxian29-Jan-15 14:27
professionalphyxian29-Jan-15 14:27 
GeneralRe: How do I load a UI based on a user specific role Pin
Richard MacCutchan29-Jan-15 23:02
mveRichard MacCutchan29-Jan-15 23:02 
GeneralRe: How do I load a UI based on a user specific role Pin
phyxian30-Jan-15 0:10
professionalphyxian30-Jan-15 0:10 
GeneralRe: How do I load a UI based on a user specific role Pin
Richard MacCutchan30-Jan-15 0:13
mveRichard MacCutchan30-Jan-15 0:13 
GeneralRe: How do I load a UI based on a user specific role Pin
Eddy Vluggen30-Jan-15 0:31
professionalEddy Vluggen30-Jan-15 0:31 
AnswerRe: How do I load a UI based on a user specific role Pin
BillWoodruff29-Jan-15 5:47
professionalBillWoodruff29-Jan-15 5:47 
AnswerRe: How do I load a UI based on a user specific role Pin
Mycroft Holmes30-Jan-15 13:34
professionalMycroft Holmes30-Jan-15 13:34 
AnswerRe: How do I load a UI based on a user specific role Pin
BillWoodruff31-Jan-15 18:34
professionalBillWoodruff31-Jan-15 18:34 
Now that we know this will be a Windows Forms based project: some specific ideas based on WinForms' facilities:

Assumptions:

1. you will use standard system-services to handle the security aspects of verification of log-in of users, meaning: you will use Windows' Groups/Roles/Permissions facilities and encrypted log-in information stored in your database.

Ideas:

1. Log-in Application: one Windows Form, UserName, Password, Text Fields, LogIn Button, Exit Button.

a. stand-alone project, contains no other Form definitions, no hard-coded filepaths to the location of the users' interfaces ... Forms (Admin, Manager, User ... etc.).

2. UserFormLocator Service: receives a request from the Log-in app for a path to a valid folder containing the .dll with the user-interface appropriate to the logged-in User, and returns the filePath to the LogIn app after a valid log-on.

3. Forms for different types of Users ... for example, Admin, Manager, User1 ... these can, of course, all use a common base host interface. For example, you could have one main Form with certain common features defined in a .dll, then have a separate .dll containing a Panel with all the specific Controls for each type of user. At run-time the common Form can be loaded, and then the specific Panel loaded and inserted into the common Form's Controls collection.

4. After a valid log-in, the Log-in Application uses the filepath to the .dll returned by the Service to Load and instantiate the particular user interface for a given type of User. The Log-In Application closes its own UI and transfers the message loop to the newly instantiated user-interface (Form).

Technical Note on 4.:

This requires use of an explicit ApplicationContext in WinForms: rather than starting the Application with the usual command to "Run" a Form, the Application is started by launching the instance of an ApplicationContext: this allows one to close any given Form and open any other Form. This also requires some caution since the Application can still be running with no open Forms: typically the need to close a WinForms app launched in this way is dealt with by over-loading the Closing EventHandler of all Forms and shutting down the Application when the last open form is closing.

Conclusion:

I've omitted code here, and other technical details, including the probable need for the Log-In Application and the dynamically loaded user-interfaces to share Interfaces. If there are further detailed questions on what's described here, I will respond with code, as appropriate.

The key idea is that the Log-In application be as "divorced" from the final interfaces loaded for different types of Users as possible for (what I hope are obvious) security reasons.

I have implemented each step described above to the "proof of concept" level.
«I'm asked why doesn't C# implement feature X all the time. The answer's always the same: because no one ever designed, specified, implemented, tested, documented, shipped that feature. All six of those things are necessary to make a feature happen. They all cost huge amounts of time, effort and money.» Eric Lippert, Microsoft, 2009

GeneralRe: How do I load a UI based on a user specific role Pin
CHill601-Feb-15 21:13
mveCHill601-Feb-15 21:13 
QuestionDesign question for a project in C# Pin
Malindor23-Jan-15 6:06
Malindor23-Jan-15 6:06 
AnswerRe: Design question for a project in C# Pin
Matt T Heffron23-Jan-15 14:10
professionalMatt T Heffron23-Jan-15 14:10 
Question'Interface' Considered Harmful : Uncle Bob Pin
popchecker14-Jan-15 17:48
popchecker14-Jan-15 17:48 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
PIEBALDconsult14-Jan-15 17:53
mvePIEBALDconsult14-Jan-15 17:53 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker14-Jan-15 18:20
popchecker14-Jan-15 18:20 
AnswerRe: 'Interface' Considered Harmful : Uncle Bob Pin
Pete O'Hanlon14-Jan-15 20:29
mvePete O'Hanlon14-Jan-15 20:29 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Richard MacCutchan14-Jan-15 22:47
mveRichard MacCutchan14-Jan-15 22:47 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker15-Jan-15 0:52
popchecker15-Jan-15 0:52 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Richard MacCutchan15-Jan-15 2:29
mveRichard MacCutchan15-Jan-15 2:29 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker15-Jan-15 2:44
popchecker15-Jan-15 2:44 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Richard MacCutchan15-Jan-15 3:03
mveRichard MacCutchan15-Jan-15 3:03 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker15-Jan-15 3:54
popchecker15-Jan-15 3:54 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Pete O'Hanlon15-Jan-15 5:35
mvePete O'Hanlon15-Jan-15 5:35 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker15-Jan-15 17:08
popchecker15-Jan-15 17:08 
AnswerRe: 'Interface' Considered Harmful : Uncle Bob Pin
Keld Ølykke5-Mar-15 3:53
Keld Ølykke5-Mar-15 3:53 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
TheGreatAndPowerfulOz23-Jun-15 10:15
TheGreatAndPowerfulOz23-Jun-15 10:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.