C# 重起程序

mac2022-06-30  38

private void Restart() { Thread thtmp = new Thread(new ParameterizedThreadStart(run)); object appName = Application.ExecutablePath; Thread.Sleep(2000); thtmp.Start(appName); } private void run(Object obj) { Process ps = new Process(); ps.StartInfo.FileName = obj.ToString(); ps.Start(); } /// /// 设置 /// /// /// private void btnConfig_Click(object sender, EventArgs e) { frmHikClientConfig frm = new frmHikClientConfig(); if (frm.ShowDialog() == DialogResult.OK) { Application.ExitThread(); Restart(); } }

转载于:https://www.cnblogs.com/deepwishly/archive/2010/07/02/2551230.html

相关资源:C#退出程序再重新启动
最新回复(0)