- 重启的时间间隔方法
private void Restart() { Thread thtmp = new Thread(new ParameterizedThreadStart(run)); object appName = Application.ExecutablePath; Thread.Sleep(); thtmp.Start(appName); } private void run(Object obj) { Process ps = new Process(); ps.StartInfo.FileName = obj.ToString(); ps.Start(); }
2.单击按钮执行重启
private void btnConfig_Click(object sender, EventArgs e) { frmHikClientConfig frm = new frmHikClientConfig(); if (frm.ShowDialog() == DialogResult.OK) { Application.ExitThread(); Restart(); } }