使用C#应用程序重新启动 [英] Restart application using C#

查看:224
本文介绍了使用C#应用程序重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用C#重新启动我的WPF应用程序?

How can I restart my WPF application using C#?

推荐答案

我不认为有一个在WPF的直接方法,像有在的WinForms。但是,你可以使用从这样的 Windowns.Form 命名空间的方法:(您可能需要添加一个引用到 System.Windows.Form 组装)

I don't think there's a direct method in WPF like there is in WinForms. However, you could use methods from the Windowns.Form namespace like this: (You might need to add a reference to the System.Windows.Form assembly)

System.Windows.Forms.Application.Restart();

System.Windows.Application.Current.Shutdown();

这篇关于使用C#应用程序重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆