检测 outlook 检查器 window 是否已关闭

Detect if outlook inspector window has closed

对于 Outlook 2016 的插件,我必须检测检查员 window(电子邮件 window)是否已关闭。

我在 Microsoft 网站上找到了一个 guid,但我似乎无法使用它。 https://msdn.microsoft.com/en-us/library/office/ff184620.aspx
我似乎找不到向关闭事件添加方法的方法

((Outlook.InspectorEvents_Event)inspector).Close +=
        new Outlook.InspectorEvents_CloseEventHandler(
        OutlookInspectorWindow_Close);

有没有人找到让它工作的方法? 我好像没有 InspectorEvents_Events 对象。

提前致谢




编辑

我的关闭不是一个事件,而是一种方法,如这里所述 Registering to the Outlook appointment item 'closed' event using VSTO
您必须强制转换使用:

((InspectorEvents_10_Event)inspector).Close += Closed;

我没有让它工作,因为我的编译器没有建议 InspectorEvents_Event 或 InspectorEvents_10_Event

您需要将检查器对象转换为 InspectorEvents_10_Event 接口:

        var inspector = Inspector as InspectorEvents_10_Event;
        if (inspector != null)
        {
            inspector.Close += OnInspectorClose;
        }