mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 11:37:40 +00:00
MailEvents experiment
This commit is contained in:
parent
94d1db275c
commit
50147d3c4b
@ -14,5 +14,11 @@ namespace Acacia.Stubs
|
|||||||
{
|
{
|
||||||
return Mapping.WrapOrDefault<IFolder>(obj);
|
return Mapping.WrapOrDefault<IFolder>(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static WrapType Wrap<WrapType>(object o, bool mustRelease = true)
|
||||||
|
where WrapType : IBase
|
||||||
|
{
|
||||||
|
return Mapping.Wrap<WrapType>(o, mustRelease);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,11 +216,16 @@ namespace Acacia.Utils
|
|||||||
|
|
||||||
private void OnItemLoad(object item)
|
private void OnItemLoad(object item)
|
||||||
{
|
{
|
||||||
|
using (IItem wrapped = Wrappers.Wrap<IItem>(item))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
NSOutlook.ItemEvents_10_Event hasEvents = item as NSOutlook.ItemEvents_10_Event;
|
NSOutlook.ItemEvents_10_Event hasEvents = item as NSOutlook.ItemEvents_10_Event;
|
||||||
if (hasEvents != null)
|
if (hasEvents != null)
|
||||||
{
|
{
|
||||||
new MailEventHooker(hasEvents, this);
|
new MailEventHooker(hasEvents, this);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MailEventHooker : ComWrapper<NSOutlook.ItemEvents_10_Event>
|
private class MailEventHooker : ComWrapper<NSOutlook.ItemEvents_10_Event>
|
||||||
@ -237,6 +242,11 @@ namespace Acacia.Utils
|
|||||||
HookEvents(true);
|
HookEvents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~MailEventHooker()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected override void DoRelease()
|
protected override void DoRelease()
|
||||||
{
|
{
|
||||||
Logger.Instance.Debug(this, "DoRelease: {0}", _id);
|
Logger.Instance.Debug(this, "DoRelease: {0}", _id);
|
||||||
@ -302,8 +312,8 @@ namespace Acacia.Utils
|
|||||||
{
|
{
|
||||||
Logger.Instance.Debug(this, "HandleUnload: {0}", _id);
|
Logger.Instance.Debug(this, "HandleUnload: {0}", _id);
|
||||||
// All events must be unhooked on unload, otherwise a resource leak is created.
|
// All events must be unhooked on unload, otherwise a resource leak is created.
|
||||||
HookEvents(false);
|
//HookEvents(false);
|
||||||
Dispose();
|
//Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleWrite(ref bool cancel)
|
private void HandleWrite(ref bool cancel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user