problem calling Login in Winform app.

problem calling Login in Winform app.

Old forum URL: forums.lhotka.net/forums/t/4307.aspx


Rayk posted on Wednesday, February 06, 2008

We have a windows app that is using CSLA.  It is somewhat patterned after the example Project app. 

If we call Login from the MainForm.Load(), all works well.  However, the login form disappears and then the mainform appears later.  There may be a few seconds when the user is not clear what is happening, because there is no form on the screen at all.

To correct this, we are trying to move the login code.  We want the main window to fire up, then we'll have the user login, and set menu security appropriately. 

The problem comes when we move the Login code.  Apparently, the applicationContext is different in the various methods of MainForm, so if we put it in the MainForm.Shown() area, the application doesn't know the user who is logged in.

Does this sound familiar to anyone?  I've checked the forums and can't find any reference to this type of problem.

We are also using DevExpress components, but I don't think that is the cause.

Thanks,
Ray

tetranz replied on Wednesday, February 06, 2008

Hi Ray

Yes I remember messing about trying to get my login to work smoothly and look good for the user. I don't remember having problems with applicationContext though.

The main parts of what I have now is ...

Program.cs opens my login form only, not the main form.
The Login button, if successful, just closes the login form.
The Cancel button also just closes the login form.

In the login form FormClosed event, if we logged in then I open the main form, else do nothing.

That works smoothly. The main form seems to appear at the same time or perhaps slightly before the login form disappears. There is no period of nothingness.

Cheers
Ross

Copyright (c) Marimer LLC