HeartBeatMonitor.cs
838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace MoyaSignup
{
public class HeartBeatMonitor
{
Thread thdMonitorLoop;
private bool run = true;
public HeartBeatMonitor()
{
thdMonitorLoop = new Thread(new ThreadStart(monitorLoop));
thdMonitorLoop.Start();
}
public void Stop()
{
run = false;
}
private void monitorLoop()
{
while (run)
{
Thread.Sleep(100);
if (Program.HeartBeat.AddMilliseconds(4000) < System.DateTime.Now)
{
Application.Run(new MoyaSignup.WaitForm());
}
}
}
}
}