Prism 应用程序关闭时不退出 [英] Prism App Does Not Exit When Closed

查看:94
本文介绍了Prism 应用程序关闭时不退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习棱镜,但遇到了问题.

I am learning prism and I have hit a problem.

我制作了一款与 Mike Taulty 制作的应用非常相似的应用,该应用是关于 Prism 的精彩教程.最大的不同是我的应用程序是 WPF 应用程序而不是 Silverlight.

I have made an app very similar to the one that Mike Taulty makes in is great tutoral about Prism. The biggest difference is that my app is a WPF app instead of Silverlight.

我发现我遇到了问题.当我关闭主 shell 窗口时,应用程序不会退出.窗口走了一段路,但调试器仍处于活动状态.

I am finding that I have hit a problem though. When I close the main shell window, the app does not exit. The window goes a way, but the debugger is still active.

我曾尝试寻找调用堆栈等,但 Visual Studio 只是告诉我它是外部代码".

I have tried looking for call stacks and such, but Visual Studio just tells me that it is "External Code".

关于我可以做什么/寻找什么来解决这个问题的任何想法?

Any ideas on what I can do/look for to fix this?

推荐答案

覆盖 App.xaml 后面代码中的 OnStartup 方法,并添加:

Override the OnStartup method in the code behind of your App.xaml, and add this:

this.ShutdownMode = ShutdownMode.OnMainWindowClose; 

HTH

这篇关于Prism 应用程序关闭时不退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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