VSTO事件未正常触发 [英] VSTO Events are not firing properly

查看:219
本文介绍了VSTO事件未正常触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  创建了一个VSTO插件,用于更新数据库中的约会和附加事件(写入和删除事件)到每个约会 
applicationObject_ItemLoad。


此applicationObject_ItemLoad似乎会在每个约会首次加载时触发。我还需要捕获主要约会  资源管理器页面。


但似乎某些约会事件正在失败。你能否建议最好的地方来附上活动或建议一个替代方案。


JOHN

解决方案

Hello John,

欢迎来到MSDN论坛!

根据我对您的问题的理解,您试图将事件附加到特定的AppointmentItem当它第一次加载时,但对于某些约会,这不起作用。

正如你在帖子中提到的那样"
但似乎某些约会事件正在失败 ",你的意思是 对于某些  AppointmentItem Application.ItemLoad事件从未被触发或ItemLoad事件被触发并且您成功附加了Write和 删除事件处理程序但是在一些之后它们会丢失。

如果是第一种情况,我们可以使用 Explorer.SelectChange 事件为
另类。
如果这是第二种情况,事件在我们将它们附加到AppointmentItem后停止触发,这可能发生在.Net GC系统收集AppointmentItem对象时。要解决此问题,我们应该声明类级变量来存储这些AppointmentItem。
这里有一个示例演示如何创建一个Inspector类来跟踪所有Outlook Inspectors中的所有事件,这个概念与约会相同,请参阅:
http:// www .outlookcode.com / codedetail.aspx?id = 1734

由于我不确定你的代码是如何编写的,我无法重现这个问题。因此,如果您提供一些代码片段,这对我们来说是非常有用的帮助。

谢谢。



Tim Li


MSDN订阅者支持 在论坛中


如果您对我们的支持有任何反馈,请联系 EMAIL GONE


 


Hi
I  have created a VSTO addin for updating the appointments in database and attached event(Write and Delete event) to each appointment  on
applicationObject_ItemLoad.

This applicationObject_ItemLoad seems to fire on each appointments first load. I also need to capture the dragging event of appointment  in the Main appointment  Explorer page.

But it seems the events are losing for some of the appointments. Could you suggest best place for attaching the events or suggest an alternative for the same.


JOHN

解决方案

Hello John,

Welcome to MSDN forums!

As my understanding to your question, you are trying to attach event to a specific AppointmentItem when it's load at first time, but for some Appointments this doesn't work.

As you metioned this in your post "
But it seems the events are losing for some of the appointments", do you mean for some AppointmentItem Application.ItemLoad event never triggered or ItemLoad event was triggered and you successfully attached Write and Delete event handler but after some while they are lost.

If it's the first case, we could use Explorer.SelectChange event as a
alternative.
If it's the second case, the event stop firing later after we attach them to the AppointmentItem, this might happen when the AppointmentItem Object is be collected by the .Net GC system. To resolve this we should declare class-level variables to store these AppointmentItem.
Here's a sample demonstrates how to create a Inspector Class to track all the events within all the Outlook Inspectors, the concept is the same as the appointments, please refer to :
http://www.outlookcode.com/codedetail.aspx?id=1734

Since I'm not sure how your code been written, I'm not able to reproduce this issue in my side, therefore, if you provide some code snippet that would be a great help for us to make it work.

Thanks.


Tim Li

MSDN Subscriber Support in Forum

If you have any feedback on our support, please contact EMAIL GONE

 


这篇关于VSTO事件未正常触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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