ApplicationContext class question

ApplicationContext class question

Post by crai » Thu, 27 Jan 2005 02:59:05

I have just come across the ApplicationContext class and I am wondering if
it might not be a best practice to use this object for the purpose of
encapsulating the logic that controls when the main form in an application
is actually displayed. For example, in my app, I would like to display a
login form (and maybe a splash screen) prior to actually giving the user
access to the main form. Right now, I display the login form from within
the load event of my main form. But, I am wondering if I could encapsulate
logic to display the login form, accept the user's login credentials,
authenticate the user, etc. in the ApplicationContext object, and then only
display the main from after the user has been authenticated. This way, if
the user is not authenticated, the main form never gets loaded and the
application exits.

It just seems like it would make sense to keep the logic that "oversees" the
display of forms out of the main form itself.

Has anyone done anything like this? Is there a design pattern for doing