使用嵌套表单时处理 PocketPC 的任务管理器停止运行程序
我有一个用 Visual Studio 2005 编写的 PocketPC C# 应用程序。它使用嵌套表单(向用户呈现一个带有多个按钮的表单,当用户选择一个按钮时,将打开一个新表单)。
我添加了代码,以便第一个表单将其标题设置为 string.Empty
以将其从正在运行的程序列表中隐藏。当显示第二个表单并且用户使用任务管理器停止我的应用程序时,第二个表单会收到关闭事件。
有什么方法可以知道关闭事件来自任务管理器,以便我可以关闭我的应用程序?在对关闭事件进行断点时,我看到 DialogResult 被设置为 DialogResult.OK(这没有帮助),并且第二个对话框被关闭,将控制权返回给认为用户选择的调用者确定并打开下一个对话框。
我已在 Google 上搜索信息,但所有有用的代码(例如 ClosingEventArgs
)在紧凑框架中均不可用。有什么想法吗?
I have a PocketPC C# application written in Visual Studio 2005. It uses nested forms (the user is presented with a form with multiple buttons, when the user selects one a new form is opened).
I've added code so that the 1st form sets it's title to string.Empty
to hide it from the Running Programs List. When the 2nd form is showing and the user uses the task manager to stop my app, the 2nd form gets the on close event.
Is there any way of knowing that the close event has come from the task manager so that I can close my application? At the moment when breakpointing the close event, I'm seeing the DialogResult being set as DialogResult.OK
(Which isn't helpful) and the 2nd dialog is closed returning control to caller which thinks the user selected OK and opens the next dialog.
I've Googled for info but all the helpful code such as ClosingEventArgs
aren't available in the compact framework. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可能遗漏了一些东西,但如果您的问题是区分正常关闭的第二个对话框和使用任务管理器关闭的对话框,您能否在正常关闭操作发生时、关闭之前设置某种标记?从逻辑上讲,任何未设置标记的关闭事件都将由任务管理器处理?
I may be missing something but if your problem is distinguishing between the 2nd dialog being closed normally, and being closed using task manager, can you not set some kind of marker when the normal close action occurs, before closing? Logically then any close event where the marker has not been set will be down to the task manager?