Exemple #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, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            try
            {
                _addInInstance     = (AddIn)addInInst;
                _applicationObject = (DTE2)ServiceCache.ExtensibilityModel;

                lock (_twoOnConnectionLock)
                {
                    if (_ssmsAbstract != null)
                    {
                        _ssmsAbstract.command_manager.CustomCleanup();
                        _ssmsAbstract = null;
                    }

                    if (_ssmsAbstract == null)
                    {
                        _ssmsAbstract = new SsmsAbstract(_addInInstance, _applicationObject);
                    }

                    if (_scriptInit == null)
                    {
                        _scriptInit = new AddinInitializer();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message, "OnConnection");
            }
        }
        public bool Should_Have_Saved_Correct_Executable_To_Assembly_Path(string runnerName)
        {
            var expectedPath = Path.Combine(this.addinAssemblyDirectory, runnerName);

            if (File.Exists(expectedPath))
            {
                File.Delete(expectedPath);
            }

            AddinInitializer.Initialize();
            // The file should have been saved to path already in the setup method

            return(File.Exists(expectedPath));
        }
 public void InitializeAddin()
 {
     AddinInitializer.Initialize();
 }