Esempio n. 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);
            }
        }
Esempio n. 2
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 );
			}
		}