📄 applicationevents_10_eventprovider.cs
字号:
namespace Microsoft.Office.Interop.Outlook
{
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Threading;
internal sealed class ApplicationEvents_10_EventProvider : ApplicationEvents_10_Event, IDisposable
{
private ArrayList m_aEventSinkHelpers;
private UCOMIConnectionPoint m_ConnectionPoint;
private UCOMIConnectionPointContainer m_ConnectionPointContainer;
public ApplicationEvents_10_EventProvider(object obj1)
{
this.m_ConnectionPointContainer = (UCOMIConnectionPointContainer) obj1;
}
public override void add_AdvancedSearchComplete(ApplicationEvents_10_AdvancedSearchCompleteEventHandler handler1)
{
lock (this)
{
if (this.m_ConnectionPoint == null)
{
this.Init();
}
ApplicationEvents_10_SinkHelper helper = new ApplicationEvents_10_SinkHelper();
int pdwCookie = 0;
this.m_ConnectionPoint.Advise((object) helper, out pdwCookie);
helper.m_dwCookie = pdwCookie;
helper.m_AdvancedSearchCompleteDelegate = handler1;
this.m_aEventSinkHelpers.Add((object) helper);
}
}
public override void add_AdvancedSearchStopped(ApplicationEvents_10_AdvancedSearchStoppedEventHandler handler1)
{
lock (this)
{
if (this.m_ConnectionPoint == null)
{
this.Init();
}
ApplicationEvents_10_SinkHelper helper = new ApplicationEvents_10_SinkHelper();
int pdwCookie = 0;
this.m_ConnectionPoint.Advise((object) helper, out pdwCookie);
helper.m_dwCookie = pdwCookie;
helper.m_AdvancedSearchStoppedDelegate = handler1;
this.m_aEventSinkHelpers.Add((object) helper);
}
}
public override void add_ItemSend(ApplicationEvents_10_ItemSendEventHandler handler1)
{
lock (this)
{
if (this.m_ConnectionPoint == null)
{
this.Init();
}
ApplicationEvents_10_SinkHelper helper = new ApplicationEvents_10_SinkHelper();
int pdwCookie = 0;
this.m_ConnectionPoint.Advise((object) helper, out pdwCookie);
helper.m_dwCookie = pdwCookie;
helper.m_ItemSendDelegate = handler1;
this.m_aEventSinkHelpers.Add((object) helper);
}
}
public override void add_MAPILogonComplete(ApplicationEvents_10_MAPILogonCompleteEventHandler handler1)
{
lock (this)
{
if (this.m_ConnectionPoint == null)
{
this.Init();
}
ApplicationEvents_10_SinkHelper helper = new ApplicationEvents_10_SinkHelper();
int pdwCookie = 0;
this.m_ConnectionPoint.Advise((object) helper, out pdwCookie);
helper.m_dwCookie = pdwCookie;
helper.m_MAPILogonCompleteDelegate = handler1;
this.m_aEventSinkHelpers.Add((object) helper);
}
}
public override void add_NewMail(ApplicationEvents_10_NewMailEventHandler handler1)
{
lock (this)
{
if (this.m_ConnectionPoint == null)
{
this.Init();
}
ApplicationEvents_10_SinkHelper helper = new ApplicationEvents_10_SinkHelper();
int pdwCookie = 0;
this.m_ConnectionPoint.Advise((object) helper, out pdwCookie);
helper.m_dwCookie = pdwCookie;
helper.m_NewMailDelegate = handler1;
this.m_aEventSinkHelpers.Add((object) helper);
}
}
public override void add_OptionsPagesAdd(ApplicationEvents_10_OptionsPagesAddEventHandler handler1)
{
lock (this)
{
if (this.m_ConnectionPoint == null)
{
this.Init();
}
ApplicationEvents_10_SinkHelper helper = new ApplicationEvents_10_SinkHelper();
int pdwCookie = 0;
this.m_ConnectionPoint.Advise((object) helper, out pdwCookie);
helper.m_dwCookie = pdwCookie;
helper.m_OptionsPagesAddDelegate = handler1;
this.m_aEventSinkHelpers.Add((object) helper);
}
}
public override void add_Quit(ApplicationEvents_10_QuitEventHandler handler1)
{
lock (this)
{
if (this.m_ConnectionPoint == null)
{
this.Init();
}
ApplicationEvents_10_SinkHelper helper = new ApplicationEvents_10_SinkHelper();
int pdwCookie = 0;
this.m_ConnectionPoint.Advise((object) helper, out pdwCookie);
helper.m_dwCookie = pdwCookie;
helper.m_QuitDelegate = handler1;
this.m_aEventSinkHelpers.Add((object) helper);
}
}
public override void add_Reminder(ApplicationEvents_10_ReminderEventHandler handler1)
{
lock (this)
{
if (this.m_ConnectionPoint == null)
{
this.Init();
}
ApplicationEvents_10_SinkHelper helper = new ApplicationEvents_10_SinkHelper();
int pdwCookie = 0;
this.m_ConnectionPoint.Advise((object) helper, out pdwCookie);
helper.m_dwCookie = pdwCookie;
helper.m_ReminderDelegate = handler1;
this.m_aEventSinkHelpers.Add((object) helper);
}
}
public override void add_Startup(ApplicationEvents_10_StartupEventHandler handler1)
{
lock (this)
{
if (this.m_ConnectionPoint == null)
{
this.Init();
}
ApplicationEvents_10_SinkHelper helper = new ApplicationEvents_10_SinkHelper();
int pdwCookie = 0;
this.m_ConnectionPoint.Advise((object) helper, out pdwCookie);
helper.m_dwCookie = pdwCookie;
helper.m_StartupDelegate = handler1;
this.m_aEventSinkHelpers.Add((object) helper);
}
}
public override void Dispose()
{
this.Finalize();
GC.SuppressFinalize(this);
}
public override void Finalize()
{
Monitor.Enter(this);
try
{
if (this.m_ConnectionPoint != null)
{
int count = this.m_aEventSinkHelpers.Count;
int num2 = 0;
if (0 < count)
{
do
{
ApplicationEvents_10_SinkHelper helper = (ApplicationEvents_10_SinkHelper) this.m_aEventSinkHelpers[num2];
this.m_ConnectionPoint.Unadvise(helper.m_dwCookie);
num2++;
}
while (num2 < count);
}
Marshal.ReleaseComObject(this.m_ConnectionPoint);
}
}
catch (Exception)
{
}
finally
{
Monitor.Exit(this);
}
}
private void Init()
{
UCOMIConnectionPoint ppCP = null;
byte[] b = new byte[] { 14, 0x30, 6, 0, 0, 0, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 70 };
Guid riid = new Guid(b);
this.m_ConnectionPointContainer.FindConnectionPoint(ref riid, out ppCP);
this.m_ConnectionPoint = ppCP;
this.m_aEventSinkHelpers = new ArrayList();
}
public override void remove_AdvancedSearchComplete(ApplicationEvents_10_AdvancedSearchCompleteEventHandler handler1)
{
lock (this)
{
int count = this.m_aEventSinkHelpers.Count;
int index = 0;
if (0 < count)
{
do
{
ApplicationEvents_10_SinkHelper helper = (ApplicationEvents_10_SinkHelper) this.m_aEventSinkHelpers[index];
if ((helper.m_AdvancedSearchCompleteDelegate != null) && (helper.m_AdvancedSearchCompleteDelegate.Equals((object) handler1) & 0xff))
{
this.m_aEventSinkHelpers.RemoveAt(index);
this.m_ConnectionPoint.Unadvise(helper.m_dwCookie);
if (count <= 1)
{
Marshal.ReleaseComObject(this.m_ConnectionPoint);
this.m_ConnectionPoint = null;
this.m_aEventSinkHelpers = null;
}
break;
}
index++;
}
while (index < count);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -