111,126
社区成员
发帖
与我相关
我的任务
分享
int Count=0
private void timer1_Tick(object sender, EventArgs e)
{
Count++;
if (Count == 1000)//运行1000次后自动重启
{
Process p = new Process();
p.StartInfo.FileName = Application.ExecutablePath;
this.Close();
Application.ExitThread();
Thread.Sleep(10000);
p.Start();
}
}
Process p = new Process();
p.StartInfo.FileName = Application.ExecutablePath;
p.Start();
Thread.Sleep(10000);
Process.GetCurrentProcess().Kill();
if (Count == 1000)//运行1000次后自动重启
{
Application.Restart();
}