| Author: Praveen 21 Nov 2008 | Member Level: Diamond | Rating:  Points: 6 |
private void Form1_Deactivate(object sender, EventArgs e) { timer1.Stop(); timer1.Enabled = false; MessageBox.Show("From Deactivated"); }
private void Form1_Activated(object sender, EventArgs e) { if (!(timer1.Enabled)) { timer1.Enabled = true; //MessageBox.Show("From Activated and in Timer"); timer1.Interval = 10000*30; timer1.Tick += new EventHandler(timer1_Tick); timer1.Start(); } }
void timer1_Tick(object sender, EventArgs e) { //here u can forcably logout the current user and redirect to login page }
and dont give message box to check as it self it losting focus and hope ur req is for windows application
hope this will ehlp u
|
| Author: Legend 21 Nov 2008 | Member Level: Silver | Rating:  Points: 5 |
private void Form1_Deactivate(object sender, EventArgs e) { timer1.Stop(); timer1.Enabled = false; MessageBox.Show("From Deactivated"); }
private void Form1_Activated(object sender, EventArgs e) { if (!(timer1.Enabled)) { timer1.Enabled = true; //MessageBox.Show("From Activated and in Timer"); timer1.Interval = 10000*30; timer1.Tick += new EventHandler(timer1_Tick); timer1.Start(); } }
|