I have a main form that I load and when 20 minutes have passed I want a login form to open for security reasons. I want to verify that the proper user is using the software so I have thought about using a timer and give the timer an interval of 20 minutes. This is my code:
private void timer1_Tick_1(object sender, EventArgs e)
{
foreach (Form f in Application.OpenForms)
{
if (f.Name != "login2")
{
login2 lss = new login2();
lss.ShowDialog();
}
}
}
The problem here is that it opens the form every 20 minutes. This means that if the user is not doing anything, it is just showing one login form after another, causing multiple login forms to appear, which I do not want. I have used the loop but it still do not get it working properly. I do not know why.
apart from this can I implement the function that if the form is idle for 20 mints then show the login form and id not idle then don't show the login form?? is it easy to implement? I don't want any complication as I am a new comer to c# doing first time