Search code examples
c#windowswinformsvisual-studio-2010msn-messenger

windows forms MSN Messenger Login


Ive got a basic questions about windows forms, im designing a app in visual c# express, It needs a login, heres where im stuck,

Take msn messenger loads up and you get the use/pass prompt, put the details in and then you get your contacts,

How would you replicate something like that

in the simpilist form is this 2 seperate forms? ie a login form and a contact form? or is this one form with dynamic controls? etc


Solution

  • This is what I'd suggest:

    1. Have a central form in your application, you could call it "frmMain" for-the-purpose-of-discussion, and ensure that this form is the first thing that loads up on application start-up -

      Program { Main() { Application.Run(frmMain()); } }

    2. Next, define a central app-level properties management class, FTPOD - "AppProperties"

    3. Define, configure and manage the logged in users' entity in this class
    4. This is so that, if the user is logged in then the details like login-name, id, email address, etcetera can be easily accessed at any time in the application life-span i.e., from any form
    5. Have a method in this class to check whether a user is logged in or not, FTPOD - "IsUserAuthenticated"
    6. Now when the Form_Load event of the "frmMain" is invoked, check if the user is logged-in
    7. If not then open a new form for requesting the user for login credentials, FTPOD - "frmLogin"

    ``

    frmLogin login = new frmLogin()
    login.ShowDialog(this);
    login = null;
    
    1. Manage your authentication/login logic in this form ("frmLogin"), or as relevant in its business logic
    2. Upon successful authentication, set the users' entity in the "AppProperties" class and then close the from
    3. Then from the "frmMain" class (once authenticated) open your main functioning form