Hello
Simple way is using
ShowDialog()
1. Use Timer Control in MainForm
Look at here
2. After "n" seconds or after clicking a Button,(in MianForm):
private void MyTimer_Tick(object sender, EventArgs e)
{
MyTimer.Stop();
AuthenticationForm.ShowDialog();
}
AuthenticationForm
is a winFrom that you've created it for entering UserName and Password.
The application wont be accessible by user while the
AuthenticationForm
is opening.
3. If you want to pause another processes in the application, you can make it manually. (
Use Event Handler)
4. If you use multiThreading then the solution may not work !
5. I prefer to set
Enable
of
MainForm
and other
Form
s to
false
instead of using
ShowDialog()
, then you need to store all opened form in a Collection for example
List<Form>
. You can overrid
OnLoad(EventArgs e)
method of
Form
s to store themselve into a static List.
Form.OnLoad Method
It may be threadsafe but you must look at here first:
Threading