Esempio n. 1
0
        /// <summary>
        ///      Implements the OnConnection method of the IDTExtensibility2 interface.
        ///      Receives notification that the Add-in is being loaded.
        /// </summary>
        /// <param term='application'>
        ///      Root object of the host application.
        /// </param>
        /// <param term='connectMode'>
        ///      Describes how the Add-in is being loaded.
        /// </param>
        /// <param term='addInInst'>
        ///      Object representing this Add-in.
        /// </param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
        {
            try
            {
                appOutlook    = (Microsoft.Office.Interop.Outlook.Application)application;
                addInInstance = addInInst;

                syncMgr = new SyncManager(ref appOutlook);

                syncMgr.GetSettings();

                // get a connection and update the project list information from the server
                if (syncMgr.GetConnection())
                {
                    syncMgr.GetProjects(false);
                }

                syncMgr.AddAllFolderEventHandlers();

                // If we are not loaded upon startup, forward to OnStartupComplete()
                // and pass the incoming System.Array.
                if (connectMode != ext_ConnectMode.ext_cm_Startup)
                {
                    OnStartupComplete(ref custom);
                }

                // TODO: Call this dynamically based off the system settings.
                syncMgr.StartTimer();
            }
            catch (System.Exception ex)
            {
                ErrorHandler.PublishError(ex, logger);
            }
        }