示例#1
0
        /// <summary>
        ///     Implements the OnDisconnection method of the IDTExtensibility2 interface.
        ///     Receives notification that the Add-in is being unloaded.
        /// </summary>
        /// <param term='disconnectMode'>
        ///      Describes how the Add-in is being unloaded.
        /// </param>
        /// <param term='custom'>
        ///      Array of parameters that are host application specific.
        /// </param>
        /// <seealso class='IDTExtensibility2' />
        public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
        {
            //Utils.Pt(String.Format(".Connect.OnDisconnection(disconnectMode = {0})",
//disconnectMode.ToString()));

            //===========================================================
            //DumpInfo();
            //=======================================================

            /*addInInstance = null;
             * _HeaderCommand = null;
             * _AddLinkToSelectedTopicCommand = null;
             * _HomeTab = null;
             * ribbonGroup = null;
             * _MindManager = null;
             * _SyncActiveTopicWithOnenote = null;
             * _SyncActiveTopicWithOnenote = null;
             * _SyncActiveDocumentWithOnenote = null;
             * _ImportCurrentSection = null;
             * _ManageOnenoteLinks = null;*/
            OneNote.Dispose();
            Utils.ReleaseComObject(_HeaderCommand);
            Utils.ReleaseComObject(_AddLinkToSelectedTopicCommand);
            Utils.ReleaseComObject(_HomeTab);
            Utils.ReleaseComObject(ribbonGroup);
            Utils.ReleaseComObject(_SyncActiveTopicWithOnenote);
            Utils.ReleaseComObject(_SyncActiveTopicWithOnenote);
            Utils.ReleaseComObject(_SyncActiveDocumentWithOnenote);
            Utils.ReleaseComObject(_ImportCurrentSection);
            Utils.ReleaseComObject(_MindManager);
        }
 /// <summary>
 ///		Called when an addin is released from Outlook.
 /// </summary>
 /// <remarks>
 ///		Should not be called from code.
 /// </remarks>
 /// <param name="disconnectMode">The shutdown mode.</param>
 /// <param name="custom">Any custom arguments.</param>
 public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
 {
     if (disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown)
     {
         OnBeginShutdown(ref custom);
     }
 }
 /// <summary>
 ///     Implements the OnDisconnection method of the IDTExtensibility2 interface.
 ///     Receives notification that the Add-in is being unloaded.
 /// </summary>
 /// <param term='disconnectMode'>
 ///      Describes how the Add-in is being unloaded.
 /// </param>
 /// <param term='custom'>
 ///      Array of parameters that are host application specific.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public virtual void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
 {
     if (disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown)
     {
         OnBeginShutdown(ref custom);
     }
     this._application.Dispose();
     this._addinLib = null;
 }
 /// <summary>
 /// Remove the installed menu item.
 /// </summary>
 /// <param name="xlApp">The excel application to remove the menu item from.</param>
 /// <param name="removeMode">The way how the add-in is unloaded.</param>
 /// <param name="menuName">The name of the menu frome where the menu item must be removed.</param>
 /// <param name="menuItemCaption">The caption of the mneu item to remove.</param>
 public static void RemoveMenuItem(Excel.Application xlApp, Extensibility.ext_DisconnectMode removeMode, string menuName, string menuItemCaption)
 {
     // If user unloaded add-in, remove button. Otherwise, add-in is
     // being unloaded because the application is closing; in that case,
     // leave button as is.
     if (removeMode == Extensibility.ext_DisconnectMode.ext_dm_UserClosed)
     {
         // Delete custom command bar button.
         xlApp.CommandBars[menuName].Controls[menuItemCaption].Delete(Type.Missing);
     }
 }
 public override void OnDisconnection(Extensibility.ext_DisconnectMode RemoveMode, ref Array custom)
 {
     // Unloading custom taks panes prevents the crash on Excel 2010 64-bit.
     CustomTaskPaneFactory.UnloadCustomTaskPanes();
     CustomTaskPaneFactory.DetachAddIn();
     if (Factory != null)
     {
         Marshal.ReleaseComObject(Factory);
         Factory = null;
     }
     base.OnDisconnection(RemoveMode, ref custom);
 }
 /// <summary>
 ///     Implements the OnDisconnection method of the IDTExtensibility2 interface.
 ///     Receives notification that the Add-in is being unloaded.
 /// </summary>
 /// <param term='disconnectMode'>
 ///      Describes how the Add-in is being unloaded.
 /// </param>
 /// <param term='custom'>
 ///      Array of parameters that are host application specific.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
 {
     try
     {
         if (null != _outlookApplication)
         {
             _outlookApplication.Dispose();
         }
     }
     catch (Exception ex)
     {
         string message = string.Format("An error occured.{0}{0}{1}", Environment.NewLine, ex.Message);
         MessageBox.Show(message, "OPENERP-OnDisconetion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 /// <summary>
 /// Called when the AddIn is discarded. This method allows each of the commands to
 /// to unregister and close down on exiting.
 /// </summary>
 /// <param name="application"> Root object in the application </param>
 /// <param name="connectMode"> 'Mode' in which the environment is closing the addin </param>
 /// <param name="addIn"> Object representing this AddIn in the Object Model</param>
 public void OnDisconnection(EnvDTE._DTE application, Extensibility.ext_DisconnectMode disconnectMode, EnvDTE.AddIn addIn)
 {
     application.Commands.Item("FacultyClient.Connect." + m_strCommandName, 0).Delete();
 }
示例#8
0
 /// <summary>
 ///     Implements the OnDisconnection method of the IDTExtensibility2 interface.
 ///     Receives notification that the Add-in is being unloaded.
 /// </summary>
 /// <param term='disconnectMode'>
 ///      Describes how the Add-in is being unloaded.
 /// </param>
 /// <param term='custom'>
 ///      Array of parameters that are host application specific.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
 {
     AddInUtils.RemoveMenuItem(m_xlApp, disconnectMode, m_menuName, m_menuItemCaption);
 }
 public void OnDisconnection(Extensibility.ext_DisconnectMode RemoveMode, ref Array custom)
 {
 }
示例#10
0
 // / <summary>
 // / Implements the OnDisconnection method of the IDTExtensibility2 interface.
 // / Receives notification that the Add-in is being unloaded.
 // / </summary>
 // / <param name="removeMode">Describes how the Add-in is being unloaded.</param>
 // / <param name="custom">Array of parameters that are host application specific.</param>
 void Extensibility.IDTExtensibility2.OnDisconnection(Extensibility.ext_DisconnectMode removeMode, ref Array custom)
 {
     // Empty implementation.
 }