namespace BulkArchiveMailer.AddIn { /// /// Static access point to the running add-in instance, matching the /// shape Visual Studio normally generates for VSTO projects (hand /// written here for the same reason as ThisAddIn.Designer.cs - see /// its header comment). /// /// Microsoft.Office.Tools.Outlook.OutlookAddIn has no static /// "GetInstance" helper (it is just the FormRegion-related interface /// implemented by the real base class, OutlookAddInBase) - the /// running instance is instead captured directly by /// ThisAddIn.Initialize() into below, exactly /// like the real VSTO-generated Globals class does via its /// Globals.ThisAddIn = this; assignment. /// internal static class Globals { private static ThisAddIn _thisAddIn; private static Microsoft.Office.Tools.Outlook.Factory _factory; internal static ThisAddIn ThisAddIn { get { return _thisAddIn; } set { if (_thisAddIn == null) { _thisAddIn = value; } else { throw new System.NotSupportedException(); } } } internal static Microsoft.Office.Tools.Outlook.Factory Factory { get { return _factory; } set { if (_factory == null) { _factory = value; } else { throw new System.NotSupportedException(); } } } } }