您的位置:首页 > 编程语言 > C#

C#桌面软件程序重新启动

2017-11-03 17:20 246 查看
private void Restart()
{
ThreadPool.QueueUserWorkItem(new WaitCallback(obj =>
{
string exePath = Path.Combine(GlobalVariant.Root, "上课系统.exe");
Process ps = new Process();
ps.StartInfo.FileName = exePath;
ps.StartInfo.Arguments = "restart";
ps.Start();
}));
}


程序入口方法。

[STAThread]
static void Main(string[] s)
{
bool createNew;
using (System.Threading.Mutex m = new System.Threading.Mutex(true, Application.ProductName, out createNew))
{
if (s.Length == 1 && s[0] == "restart")
{
Run();
}
else if (createNew)
{
Run();
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  winform 重启 c#