Esempio n. 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(ext_DisconnectMode disconnectMode, ref Array custom)
 {
     eventHandler.Disconnect();
     if (!commandLine)
     {
         try
         {
             initializer.removeCommands();
             UpdateDefaultEditors(false);
         }
         catch (System.Exception e)
         {
             MessageBox.Show(e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
         }
     }
 }
Esempio n. 2
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, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            _applicationObject = (DTE)application;
            _addInInstance     = (AddIn)addInInst;

            // determine the installation directory
            System.Uri uri = new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().EscapedCodeBase);
            installationDir  = Path.GetDirectoryName(System.Uri.UnescapeDataString(uri.AbsolutePath));
            installationDir += "\\";

            // General startup code
            if ((ext_ConnectMode.ext_cm_AfterStartup == connectMode) ||
                (ext_ConnectMode.ext_cm_Startup == connectMode) ||
                (ext_ConnectMode.ext_cm_CommandLine == connectMode))
            {
                QtVersionManager vm    = QtVersionManager.The();
                string           error = null;
                if (vm.HasInvalidVersions(out error))
                {
                    Messages.DisplayErrorMessage(error);
                }
                eventHandler = new AddInEventHandler(_applicationObject);
                extLoader    = new ExtLoader();
                if (ext_ConnectMode.ext_cm_CommandLine != connectMode)
                {
                    try
                    {
                        initializer = new AddinInit(_applicationObject);
                        initializer.removeCommands();
                        initializer.registerCommands();
                        UpdateDefaultEditors(true);
                    }
                    catch (System.Exception e)
                    {
                        MessageBox.Show(e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
                    }
                }
                else
                {
                    commandLine = true;
                }
            }
        }
Esempio n. 3
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, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            _applicationObject = (DTE)application;
            _addInInstance = (AddIn)addInInst;

            // determine the installation directory
            System.Uri uri = new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().EscapedCodeBase);
            installationDir = Path.GetDirectoryName(System.Uri.UnescapeDataString(uri.AbsolutePath));
            installationDir += "\\";

            // General startup code
            if ((ext_ConnectMode.ext_cm_AfterStartup == connectMode) ||
                (ext_ConnectMode.ext_cm_Startup == connectMode) ||
                (ext_ConnectMode.ext_cm_CommandLine == connectMode))
            {
                QtVersionManager vm = QtVersionManager.The();
                string error = null;
                if (vm.HasInvalidVersions(out error))
                    Messages.DisplayErrorMessage(error);
                eventHandler = new AddInEventHandler(_applicationObject);
                extLoader = new ExtLoader();
                if (ext_ConnectMode.ext_cm_CommandLine != connectMode)
                {
                    try
                    {
                        initializer = new AddinInit(_applicationObject);
                        initializer.removeCommands();
                        initializer.registerCommands();
                        UpdateDefaultEditors(true);
                    }
                    catch (System.Exception e)
                    {
                        MessageBox.Show(e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
                    }
                }
                else
                    commandLine = true;
            }
        }