Beispiel #1
0
        // Need to execute: "regsvr32 VSUserControlHost.dll"

        public void ShowToolWindow(_DTE applicationObject, AddIn addInInstance)
        {
            try
            {
                object objTemp = null;

                String guidstr = "{FDB416EB-2AC8-4714-96BC-8D39E8C9E063}";

                if (windowToolWindow == null)
                {
                    windowToolWindow = applicationObject.Windows.CreateToolWindow(addInInstance, "VSUserControlHost.VSUserControlHostCtl", "C# Tool window", guidstr, ref objTemp);

                    //When using the hosting control, you must set visible to true before calling HostUserControl,
                    // otherwise the UserControl cannot be hosted properly.
                    windowToolWindow.Visible    = true;
                    windowToolWindow.IsFloating = false;
                    windowToolWindow.Linkable   = true;
                    if (windowToolWindow.LinkedWindowFrame == null)
                    {
                        windowToolWindow.Width  = 1024;
                        windowToolWindow.Height = 768;
                    }
                    objControl = (VSUserControlHostLib.IVSUserControlHostCtl)objTemp;

                    //System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( @"C:\Documents and Settings\chris\Desktop\classes\InfoViz\SourceVis\Erato\bin\Debug\Prototype.dll" );
                    //Prototype.Controls.Class_Container.SourceVisPanel ctrl = (Prototype.Controls.Class_Container.SourceVisPanel)objControl.HostUserControl(asm.Location, "Prototype.Controls.Class_Container.SourceVisPanel");
                    //ctrl.InitSource( applicationObject );
                    //m_visPanel = ctrl;

                    Assembly asm = Assembly.GetExecutingAssembly();
                    m_frm = (TestForm)objControl.HostUserControl(asm.Location, "SmellFinder.TestForm");
                }
                else
                {
//					windowToolWindow.Visible    = true;
//					windowToolWindow.IsFloating = false;
//					windowToolWindow.Linkable   = true;
//					windowToolWindow.Width      = 1024;
//					windowToolWindow.Height     = 768;
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Beispiel #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, EnvDTE.vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
        {
            handled = false;
            if (executeOption == EnvDTE.vsCommandExecOption.vsCommandExecOptionDoDefault)
            {
                if (commandName == "SmellFinder.Connect.SmellFinder")
                {
                    handled = true;

                    //ShowToolWindow( applicationObject, addInInstance );
                    TestForm testForm = new TestForm();
                    testForm.AppObject = applicationObject;
                    testForm.Show();

                    return;
                }
            }
        }
Beispiel #3
0
		// Need to execute: "regsvr32 VSUserControlHost.dll"

		public void ShowToolWindow(_DTE applicationObject, AddIn addInInstance)
		{
			try
			{
				object objTemp = null;

				String guidstr = "{FDB416EB-2AC8-4714-96BC-8D39E8C9E063}";

				if( windowToolWindow == null )
				{
					windowToolWindow = applicationObject.Windows.CreateToolWindow (addInInstance, "VSUserControlHost.VSUserControlHostCtl", "C# Tool window", guidstr, ref objTemp);

					//When using the hosting control, you must set visible to true before calling HostUserControl,
					// otherwise the UserControl cannot be hosted properly.
					windowToolWindow.Visible    = true;
					windowToolWindow.IsFloating = false;
					windowToolWindow.Linkable   = true;
					if( windowToolWindow.LinkedWindowFrame == null )
					{
						windowToolWindow.Width      = 1024;
						windowToolWindow.Height     = 768;
					}
					objControl = (VSUserControlHostLib.IVSUserControlHostCtl)objTemp;
					
					//System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( @"C:\Documents and Settings\chris\Desktop\classes\InfoViz\SourceVis\Erato\bin\Debug\Prototype.dll" );
					//Prototype.Controls.Class_Container.SourceVisPanel ctrl = (Prototype.Controls.Class_Container.SourceVisPanel)objControl.HostUserControl(asm.Location, "Prototype.Controls.Class_Container.SourceVisPanel");
					//ctrl.InitSource( applicationObject );
					//m_visPanel = ctrl;

					Assembly asm = Assembly.GetExecutingAssembly();
					m_frm = (TestForm)objControl.HostUserControl( asm.Location, "SmellFinder.TestForm");
				}
				else
				{
//					windowToolWindow.Visible    = true;
//					windowToolWindow.IsFloating = false;
//					windowToolWindow.Linkable   = true;
//					windowToolWindow.Width      = 1024;
//					windowToolWindow.Height     = 768;
				}
			}
			catch( Exception ex )
			{
				System.Windows.Forms.MessageBox.Show( ex.Message + ex.StackTrace );
			}
		}
Beispiel #4
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, EnvDTE.vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
		{
			handled = false;
			if(executeOption == EnvDTE.vsCommandExecOption.vsCommandExecOptionDoDefault)
			{
				if(commandName == "SmellFinder.Connect.SmellFinder")
				{
					handled = true;
					
					//ShowToolWindow( applicationObject, addInInstance );
					TestForm testForm = new TestForm();
					testForm.AppObject = applicationObject;
					testForm.Show();

					return;
				}
			}
		}