代码
private void Restart()
{
System.Threading.Thread thtmp = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(run));
object appName = Application.ExecutablePath;
System.Threading.Thread.Sleep(2000);
thtmp.Start(appName);
}
private void run(Object obj)
{
System.Diagnostics.Process ps = new System.Diagnostics.Process();
ps.StartInfo.FileName = obj.ToString();
ps.Start();
}
{
System.Threading.Thread thtmp = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(run));
object appName = Application.ExecutablePath;
System.Threading.Thread.Sleep(2000);
thtmp.Start(appName);
}
private void run(Object obj)
{
System.Diagnostics.Process ps = new System.Diagnostics.Process();
ps.StartInfo.FileName = obj.ToString();
ps.Start();
}
private void btn_restart_Click(object sender, EventArgs e)
{
Application.ExitThread();
Restart();
}
{
Application.ExitThread();
Restart();
}
调用:
Application.ExitThread();
Restart();