MEF WPF - Cancel Application.Current.Shutdown() by plugins

自作多情 提交于 2019-12-30 10:29:28

问题


are there any ways to cancel

Application.Current.Shutdown();  

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?


回答1:


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



来源:https://stackoverflow.com/questions/3101801/mef-wpf-cancel-application-current-shutdown-by-plugins

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!