是否有e.CloseReason为WPF? [英] Is there an e.CloseReason for WPF?

查看:370
本文介绍了是否有e.CloseReason为WPF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我服用的计算机上的每一个可能的局势的控制,当谈到使应用程序的忠实粉丝。而现在,我开始使用WPF青睐的WinForms上的一些事情,我也开始意识到许多非常酷的事情是缺少在WPF - 以及寻找替代似乎是一个永无休止的斗争。

I'm a big fan of taking control of every possible situation on the computer when it comes to making apps. And now that I'm beginning to use favor WPF over WinForms for some things, I'm also beginning to realize that many really cool things are missing in WPF - and searching for alternatives seems to be a never-ending struggle.

在WPF中替代 e.CloseReason 为的WinForms?

Is there an alternative in WPF to e.CloseReason for WinForms?

推荐答案

在不同的理由表现为单独的事件。该关闭关闭事件都涉及到明确地关窗,以编程方式或通过ALT + F4或关闭按钮。该<一href="http://msdn.microsoft.com/en-us/library/system.windows.application.sessionending%28v=vs.110%29.aspx">Application.SessionEnding事件发生在关闭或注销,以及信息由<一曝光href="http://msdn.microsoft.com/en-us/library/system.windows.reasonsessionending%28v=vs.110%29.aspx">ReasonSessionEnding.从这个过程中退出code可以从<一读href="http://msdn.microsoft.com/en-us/library/system.windows.exiteventargs.applicationexit$c$c%28v=vs.110%29.aspx">ApplicationExit$c$c的<一个href="http://msdn.microsoft.com/en-us/library/system.windows.application.exit%28v=vs.110%29.aspx">Application.Exit事件。

The different "reasons" manifest as separate events. The Closing and Closed events are related to explicitly closing a window, either programmatically or via Alt+F4 or the close button. The Application.SessionEnding event happens at a shutdown or logoff, and information is exposed by ReasonSessionEnding. The exit code from the process can be read from ApplicationExitCode of the Application.Exit event.

这篇关于是否有e.CloseReason为WPF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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