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
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
相关文章推荐
- WPF应用程序如何重启当前的Application
- 如何获得当前应用程序的名字【Winform and WPF】
- WPF(四)Application3:如何实现单实例的应用程序(Single Instance)
- wpf如何获取应用程序中的所有窗口
- 如何获得当前应用程序所在路径
- 如何在WPF应用程序中使用Invoke
- WPF学习笔记 - 如何用WPF创建单实例应用程序
- XAF 如何扩展应用程序模型(How to: Extend the Application Model )<一> ListView显示页脚信息
- Tips: 如何让自己的应用程序,控制台程序,windows 服务收到操作系统注销或者重启的消息?
- AIX下如何重启WAS和已经部署的应用程序服务器
- 分享初学者的第一个WPF应用程序——Timer线程时时刷新当前系统时间赋值于相关属性,并将其值绑定于TextBlock的Text属性
- iphone 如何利用application load 上传应用程序
- 小文——在C# WinForm中如何使当前应用程序只允许启动一个实例
- [WPF]如何正确地用代码设置ListBox的当前选中项
- C/MFC如何获得应用程序当前路径(整理)
- 如何让自己的应用程序,控制台程序,windows 服务收到操作系统注销或者重启的消息
- 走进WPF系列学习之一 如何建立、设计、执行与部署WPF应用程序
- WPF中的应用程序级别Application
- How to run WPF - XBAP as Full Trust Application(如何运行WPF -作为完全信任的应用XBAP)
- 如何使android应用程序使用当前的主题样式