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();
}
}
}