简体   繁体   English

用户单击以关闭消息窗口时发生的事件

[英]Event when user clicks to close message window

Is there a way to know when a user clicks to close the message window and before the "do you want to save changes" dialog shows up? 有没有办法知道用户何时单击以关闭消息窗口,以及 “您要保存更改”对话框出现之前? I've registered to the Inspector.Close event but it fires only after the user has decided to save/discard the changes: ((InspectorEvents_10_Event)Inspector).Close += OnInspectorClose; 我已经注册了Inspector.Close事件,但是只有用户决定保存/放弃更改才会触发: ((InspectorEvents_10_Event)Inspector).Close += OnInspectorClose;

OK, so apparently I need to use the event from the mail item, not the inspector. 好的,因此显然我需要使用邮件项目中的事件,而不是检查器中的事件。 I need to register the handler inside eg. 我需要在里面注册处理程序。 the NewInspector handler: NewInspector处理程序:

if (inspector.CurrentItem is MailItem)
{
  MailItem item = inspector.CurrentItem as MailItem;
  ((ItemEvents_10_Event)item).Close += OnItemClose;
}

And then prepare the handler: 然后准备处理程序:

private void OnItemClose(ref bool cancel) //ItemEvents_10_CloseEventHandler
{
  ((ItemEvents_10_Event)_lastOpenedItem).Close -= OnItemClose;
  _lastOpenedItem.Close(OlInspectorClose.olDiscard);
}

And this OnItemClose will execute before the Inspector's Close event fires ( ((InspectorEvents_10_Event)Inspector).Close ). 并且此OnItemClose将在检查器的Close事件触发之前执行( ((InspectorEvents_10_Event)Inspector).Close )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用户单击WPF应用程序中的主窗口时如何关闭窗口 - How to close a window when user clicks on mainwindow in wpf application 当用户在其外部单击时,关闭WPF对话框窗口 - close a WPF Dialog Window when the user clicks outside it 当用户在作为 ShowDialog 启动的 window 之外单击时显示消息 - Show a message when user clicks outside a window thats launched as ShowDialog 处理消息窗口关闭事件 - Handle message window close event 当用户在窗体窗口外单击时如何关闭窗体? - How do I close a form when a user clicks outside the form's window? 当用户单击Visual Studio表单窗口内的任何位置时,如何弹出消息框? - How to pop up a message box when user clicks anywhere within the form window in Visual Studio? 覆盖GTK窗口关闭事件以显示消息 - Overriding GTK Window Close Event to Show a Message 用户单击任务栏上的程序时检测事件? - Detect event when user clicks the program on the taskbar? 用户单击单选按钮时触发事件 - Firing an event when a user clicks a radio button 当用户单击关闭窗口时创建的弹出消息时,是否可以从用户那里获得响应? - Is there a way to get the response from a user when they click on the pop up message created when they close the window?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM