So I'm attempting to build a login form inside of my container form in which case my container form shouldn't actually open until my login form has completed.
Inside of my Main() I have the following:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Authentication auth = new Authentication();
if (auth.ActiveDirectoryAuthentication())
{
Application.Run(new ContainerForm());
}
else
{
//Do nothing as the user has failed.
}
}
Now inside my LoginFailed() method which is intended to handle showing the LoginForm is the following:
private void FailedAuthentication()
{
//TODO: Show login form and start at AD manual authentication.
LoginForm login = new LoginForm();
login.Show();
}
Now for obvious reasons this will show the form for a second before the application closes. I need to be able to show the login form before the container form can be viewed and then once the login form closes (which is handled in the click) How can I continue my code to show the Application.Run(new ContainerForm()); after the login for closes?