MEF WPF-通过插件取消Application.Current.Shutdown() [英] MEF WPF - Cancel Application.Current.Shutdown() by plugins
本文介绍了MEF WPF-通过插件取消Application.Current.Shutdown()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以取消
Application.Current.Shutdown();
背景:我玩了一下mef,并在我的主应用程序中添加了一些插件.如有插件调用
background: i played with mef a little bit and put some plugins to my main app. if any plugin call
Application.Current.Shutdown();
我的主应用程序也关闭了,我没有机会取消此操作.有什么办法吗?
my main app shutdown too and i got no chance to cancel this. are there any ways?
推荐答案
看起来不像.因此,与其让您的插件关闭,不如让它们在您的应用程序类中调用一些方法来处理它们的关闭请求.有关更多信息,请参见下面的链接.
It don't look like it. So instead of having your plugins do a shutdown, instead have them call some method in your application class that will handle the shutdown request for them. See below link also for more info.
http://www.skylark -software.com/2009/10/canceling-application-shutdown-in-wpf.html
这篇关于MEF WPF-通过插件取消Application.Current.Shutdown()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文