MailEvents experiment

This commit is contained in:
Patrick Simpson 2017-02-13 13:03:37 +01:00
parent 94d1db275c
commit 50147d3c4b
2 changed files with 19 additions and 3 deletions

View File

@ -14,5 +14,11 @@ namespace Acacia.Stubs
{
return Mapping.WrapOrDefault<IFolder>(obj);
}
public static WrapType Wrap<WrapType>(object o, bool mustRelease = true)
where WrapType : IBase
{
return Mapping.Wrap<WrapType>(o, mustRelease);
}
}
}

View File

@ -216,11 +216,16 @@ namespace Acacia.Utils
private void OnItemLoad(object item)
{
using (IItem wrapped = Wrappers.Wrap<IItem>(item))
{
}
/*
NSOutlook.ItemEvents_10_Event hasEvents = item as NSOutlook.ItemEvents_10_Event;
if (hasEvents != null)
{
new MailEventHooker(hasEvents, this);
}
}*/
}
private class MailEventHooker : ComWrapper<NSOutlook.ItemEvents_10_Event>
@ -237,6 +242,11 @@ namespace Acacia.Utils
HookEvents(true);
}
~MailEventHooker()
{
}
protected override void DoRelease()
{
Logger.Instance.Debug(this, "DoRelease: {0}", _id);
@ -302,8 +312,8 @@ namespace Acacia.Utils
{
Logger.Instance.Debug(this, "HandleUnload: {0}", _id);
// All events must be unhooked on unload, otherwise a resource leak is created.
HookEvents(false);
Dispose();
//HookEvents(false);
//Dispose();
}
private void HandleWrite(ref bool cancel)