个人资料

跳过导航链接首页 > 博客列表 > 博客正文

WPF应用程序 重启当前的Application

分类:
// Restart current process Method 1
System.Windows.Forms.Application.Restart();
Application.Current.Shutdown();

// Restart current process Method 2
System.Reflection.Assembly.GetEntryAssembly();
string startpath = System.IO.Directory.GetCurrentDirectory();
System.Diagnostics.Process.Start(startpath + “\\xxx.exe”);
Application.Current.Shutdown();

// Restart current process Method 3
Process p = new Process();
p.StartInfo.FileName = System.AppDomain.CurrentDomain.BaseDirectory + “xxx.exe”;
p.StartInfo.UseShellExecute = false;
p.Start();
Application.Current.Shutdown();
songshizhao
最初发表2018/11/2 2:06:14 最近更新2018/11/2 2:06:14 4883
为此篇作品打分
10
   评论