- 重启的时间间隔方法
1 private void Restart()
2
3 {
4
5 Thread thtmp = new Thread(new ParameterizedThreadStart(run));
6
7 object appName = Application.ExecutablePath;
8
9 Thread.Sleep(2000);
10
11 thtmp.Start(appName);
12
13 }
14
15 private void run(Object obj)
16
17 {
18
19 Process ps = new Process();
20
21 ps.StartInfo.FileName = obj.ToString();
22
23 ps.Start();
24
25 }
2.单击按钮执行重启
1 private void btnConfig_Click(object sender, EventArgs e)
2
3 {
4
5 frmHikClientConfig frm = new frmHikClientConfig();
6
7 if (frm.ShowDialog() == DialogResult.OK)
8
9 {
10
11 Application.ExitThread();
12
13 Restart();
14
15 }
16
17 }