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:
		@@ -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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user