Пример #1
0
        /// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary>
        /// <param term='commandName'>The name of the command to execute.</param>
        /// <param term='executeOption'>Describes how the command should be run.</param>
        /// <param term='varIn'>Parameters passed from the caller to the command handler.</param>
        /// <param term='varOut'>Parameters passed from the command handler to the caller.</param>
        /// <param term='handled'>Informs the caller if the command was handled or not.</param>
        /// <seealso class='Exec' />
        public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
        {
            try
            {
                handled = false;
                if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
                {
                    if (commandName == "MyGenVS2005.Connect.MyGenVS2005Templates")
                    {
                        AddInTemplateBrowser aitb = new AddInTemplateBrowser(_applicationObject);
                        aitb.Show(System.Windows.Forms.Form.ActiveForm);

                        handled = true;
                        return;
                    }
                    else if (commandName == "MyGenVS2005.Connect.MyGenVS2005Project")
                    {
                        AddInProjectBrowser aipb = new AddInProjectBrowser(_applicationObject);
                        aipb.Show(System.Windows.Forms.Form.ActiveForm);

                        handled = true;
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                AddInErrorForm errorForm = new AddInErrorForm(ex);
                errorForm.ShowDialog(System.Windows.Forms.Form.ActiveForm);
            }
        }
Пример #2
0
		/// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary>
		/// <param term='commandName'>The name of the command to execute.</param>
		/// <param term='executeOption'>Describes how the command should be run.</param>
		/// <param term='varIn'>Parameters passed from the caller to the command handler.</param>
		/// <param term='varOut'>Parameters passed from the command handler to the caller.</param>
		/// <param term='handled'>Informs the caller if the command was handled or not.</param>
		/// <seealso class='Exec' />
		public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
		{
            try
            {
                handled = false;
                if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
                {
                    if (commandName == "MyGenVS2005.Connect.MyGenVS2005Templates")
                    {
                        AddInTemplateBrowser aitb = new AddInTemplateBrowser(_applicationObject);
                        aitb.Show(System.Windows.Forms.Form.ActiveForm);

                        handled = true;
                        return;
                    }
                    else if (commandName == "MyGenVS2005.Connect.MyGenVS2005Project")
                    {
                        AddInProjectBrowser aipb = new AddInProjectBrowser(_applicationObject);
                        aipb.Show(System.Windows.Forms.Form.ActiveForm);

                        handled = true;
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                AddInErrorForm errorForm = new AddInErrorForm(ex);
                errorForm.ShowDialog(System.Windows.Forms.Form.ActiveForm);
            }
		}