您的位置:首页 > 移动开发

WPF应用程序如何重启当前的Application

2014-10-30 14:42 260 查看

3个方法都差不多,都是先重启一个进程,然后关闭当前的进程。

[csharp]
view plaincopyprint?

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

转自http://blog.csdn.net/hustypf/article/details/12613555
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: