专业网站建设品牌,十四年专业建站经验,服务6000+客户--广州京杭网络
免费热线:400-963-0016      微信咨询  |  联系我们

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

当前位置:网站建设 > 技术支持
资料来源:网络整理       时间:2023/2/14 0:15:02       共计:3621 浏览

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

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

版权说明:
本网站凡注明“广州京杭 原创”的皆为本站原创文章,如需转载请注明出处!
本网转载皆注明出处,遵循行业规范,如发现作品内容版权或其它问题的,请与我们联系处理!
欢迎扫描右侧微信二维码与我们联系。
·上一条:c#判断字符串是否为数字? | ·下一条:在网页中添加多首音乐循环播放代码

Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有    粤ICP备16019765号 

广州京杭网络科技有限公司 版权所有