示例#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)
        {
            handled = false;
            if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
            {
                DTE2 dte = ServiceCache.ExtensibilityModel.DTE as DTE2;
                if (commandName == "MyAddin1.Connect.MyAddin1")
                {
                    Document activeDocument = null;

                    IScriptFactory scriptFactory = ServiceCache.ScriptFactory;
                    if (scriptFactory != null)
                    {
                        scriptFactory.CreateNewBlankScript(ScriptType.Sql);
                        activeDocument = dte.ActiveDocument;
                    }

                    if (activeDocument != null)
                    {
                        TextSelection ts = activeDocument.Selection as TextSelection;
                        ts.Insert("This Query Window was created with our TestAddin.", (int)vsInsertFlags.vsInsertFlagsInsertAtStart);
                    }

                    handled = true;
                }
                if (commandName == "MyAddin1.Connect.MyAddin1ToolWindowForm")
                {
                    Windows2 MyWindow = (Windows2)dte.Windows;

                    Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();

                    object MyControl  = null;
                    Window toolWindow = MyWindow.CreateToolWindow2(_addInInstance, asm.Location, "MyAddin1.MyAddinWindow", "MyAddin1.MyAddin1ToolWindowForm", "{5B7F8C1C-65B9-2aca-1Ac3-12AcBbAF21d5}", MyControl);

                    toolWindow.Visible = true;

                    handled = true;

                    /*Assembly a = Assembly.GetExecutingAssembly();
                     * object controlObject = null;
                     *
                     * Windows2 toolWindows = dte.Windows as Windows2;
                     * Window2 toolWindow;
                     *
                     *
                     * toolWindow = (Window2)toolWindows.CreateToolWindow2(_addInInstance,a.Location, "MyAddin1.MyAddin1ToolWindowForm ", "", Guid.NewGuid().ToString(), ref controlObject);
                     *
                     * toolWindow.WindowState = vsWindowState.vsWindowStateNormal;
                     * toolWindow.IsFloating = false;
                     * toolWindow.Visible = true;
                     *
                     * handled = true;*/
                }
                else
                {
                    String s  = varIn.ToString();
                    string s2 = varOut.ToString();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Creates the allocation window.
        /// </summary>
        /// <returns></returns>
        public AllocationContainer CreateAllocationWindow()
        {
            Guid id = new Guid("{65a48117-79b3-4863-b268-eb7eafc21feb}");

            Windows2 windows2 = applicationObject.Windows as Windows2;

            if (windows2 != null)
            {
                object   controlObject = null;
                Assembly asm           = Assembly.GetExecutingAssembly();

                Window toolWindow = windows2.CreateToolWindow2(this.addInInstance,
                                                               asm.Location,
                                                               "InternalsViewer.SSMSAddIn.AllocationContainer",
                                                               "Internals Viewer", "{" + id.ToString() + "}",
                                                               ref controlObject);
                // Make the window a tabbed document
                toolWindow.Linkable   = false;
                toolWindow.IsFloating = false;

                toolWindow.Visible = true;


                return(controlObject as AllocationContainer);
            }
            else
            {
                return(null);
            }
        }
示例#3
0
        private void CreateToolWindow()
        {
            object   tempControl       = null;
            Windows2 applicationWindow = (Windows2)_applicationObject.Windows;

            if (_toolWindow == null)
            {
                _toolWindow = applicationWindow.CreateToolWindow2(_addInInstance, GetType().Assembly.Location,
                                                                  typeof(MainToolWindow).FullName, WINDOW_TITLE, TOOL_WINDOW_GUID, ref tempControl);
                if ((_toolWindowControl = tempControl as MainToolWindow) != null)
                {
                    _toolWindowControl.Application = _applicationObject;
                    _toolWindowControl.Visible     = _toolWindow.Visible = true;
                }
                else
                {
                    throw new Exception(TOOL_WINDOW_CREATION_FAILURE);
                }
            }
            else
            {
                ShowToolWindow();
            }

            LaunchExternalWPFWindow();
        }
        /// <summary>
        /// Loads the tool window for upgraded task window
        /// </summary>
        private void AddToolWindow()
        {
            // Load tool window region
            object   programmableObject = null;
            string   guidString         = "{9FFC9D9B-1F39-4763-A2AF-66AED06C799E}";
            Windows2 windows2           = (Windows2)_applicationObject.Windows;
            Assembly asm = Assembly.GetExecutingAssembly();

            toolWindow         = windows2.CreateToolWindow2(_addInInstance, asm.Location, "UpgradedTaskList.TaskListControl", "Upgraded Task List", guidString, ref programmableObject);
            toolWindow.Visible = true;

            // Instantiate the TaskListControl WPF object
            toolWindowControl = (TaskListControl)toolWindow.Object;
            // Load all task items to the task window
            toolWindowControl.InitializeViewModel(ref _applicationObject);

            taskUpdateDelayTimer           = new System.Timers.Timer(UPDATE_DELAY);
            taskUpdateDelayTimer.AutoReset = false;
            taskUpdateDelayTimer.Elapsed  += new ElapsedEventHandler(taskUpdateTimer_Elapsed);

            solutionOpenedDelayTimer           = new System.Timers.Timer(SOLUTION_OPENED_DELAY);
            solutionOpenedDelayTimer.AutoReset = false;
            solutionOpenedDelayTimer.Elapsed  += new ElapsedEventHandler(solutionOpenedTimer_Elapsed);

            SetTabNameOnWindow(guidString);
        }
示例#5
0
        private void CreateExplorerWindow()
        {
            if (_explorerWindow != null)
            {
                _explorerWindow.Activate();
            }
            else
            {
                Windows2 windows2 = (Windows2)_applicationObject.Windows;
                Assembly asm      = Assembly.GetExecutingAssembly();

                object customControl = null;
                string className     = "TracExplorer.Common.TracExplorerControl";
                string caption       = "Trac Explorer";

                string asmLocation = asm.Location;
                asmLocation = asmLocation.Replace("VSTrac.dll", "Common.dll");

                _explorerWindow = windows2.CreateToolWindow2(_addInInstance, asmLocation, className,
                                                             caption, _explorerWindowGuid, ref customControl);

                Image customToolWindowTabImage = GetCustomToolWindowTabImage();
                _explorerWindow.SetTabPicture(Support.ImageToIPicture(customToolWindowTabImage));


                if (customControl != null)
                {
                    ((TracExplorerControl)customControl).TracConnect = this;
                }

                _explorerWindow.Visible = true;
            }
        }
示例#6
0
        public IToolWindowContext CreateToolWindow(string assemblyLocation, string typeName, string Caption, Guid uiTypeGuid)
        {
            Windows2 win2 = _applicationObject.Windows as Windows2;

            if (win2 != null)
            {
                object controlObject = null;

                Window  toolWindow  = win2.CreateToolWindow2(_addInInstance, assemblyLocation, typeName, Caption, "{" + uiTypeGuid.ToString() + "}", ref controlObject);
                Window2 toolWindow2 = (Window2)toolWindow;
                toolWindow.Linkable = false;
                //toolWindow.IsFloating = true;
                try
                {
                    toolWindow.WindowState = vsWindowState.vsWindowStateMaximize;
                }
                catch
                {
                }

                toolWindow.Visible = true;

                return(new ToolWindowContext(toolWindow, toolWindow2, controlObject));
            }
            return(null);
        }
        public Window2 ShowWindow <T>(AddIn addIn, string title, bool isFloating = true, int width = 450, int height = 450)
            where T : UserControl
        {
            Windows2 toolWindows = _dte.Windows as Windows2;

            if (toolWindows != null)
            {
                var    assembly      = Assembly.GetExecutingAssembly();
                var    location      = assembly.Location;
                var    type          = typeof(T);
                object controlObject = null;

                var toolWindow = (Window2)toolWindows.CreateToolWindow2(addIn, location, type.FullName, title, Guid.NewGuid().ToString(), ref controlObject);

                var dataService = new PresentationDataService();
                var presenter   = new SqlTodoExplorerPresenter((ISqlTodoExplorerView)controlObject, dataService);
                presenter.Init();

                toolWindow.WindowState = vsWindowState.vsWindowStateNormal;
                toolWindow.IsFloating  = isFloating;
                toolWindow.Width       = width;
                toolWindow.Height      = height;
                toolWindow.Visible     = true;

                return(toolWindow);
            }
            return(null);
        }
示例#8
0
        private void createJiraWindow()
        {
            try
            {
                const string guid = "{CB0B2DD2-8849-431d-B92D-E86B97115345}";

                object   obj      = null;
                Windows2 windows2 = (Windows2)applicationObject.Windows;
                string   loc      = Assembly.GetExecutingAssembly().Location;
                jiraWindow = windows2.CreateToolWindow2(addInInstance, loc, "PaZu.PaZuWindow", "Atlassian", guid, ref obj);

                // todo: this does not work - need to figure out why. Probably need to load bitmap from a satellite DLL
                // it is all sort of very stupid, no obvious reason for the failure and the exception (ArgumentException)
                // does not explain anything

                //Bitmap bmp = Properties.Resources.ide_plugin_161;
                //jiraWindow.SetTabPicture(bmp.GetHbitmap());

                jiraWindow.Visible = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("Creation of the Atlassian Connector window failed \n\n" + e);
            }
        }
示例#9
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 == "AnAppADay.JediVSIRC.Addin.Connect.JediVSIRC")
             {
                 handled = true;
                 if (_toolWindow == null)
                 {
                     string   assembly         = this.GetType().Assembly.Location;
                     string   userControlClass = typeof(JediVSIRCChatControl).FullName;
                     Windows2 appWin           = (Windows2)_applicationObject.Windows;
                     string   toolWindowGuid   = "{a88cec17-a4f5-48a2-ae4f-c6da9dbe6f13}";
                     object   control          = null;
                     _toolWindow = appWin.CreateToolWindow2(_addInInstance, assembly,
                                                            userControlClass, "AnAppADay.com Jedi Visual Studio IRC",
                                                            toolWindowGuid, ref control);
                     _toolWindow.AutoHides = false;
                     _toolWindowControl    = control as JediVSIRCChatControl;
                 }
                 _toolWindow.Visible = true;
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show("Error loading addin: " + ex.Message);
     }
 }
示例#10
0
        public override void Execute(VsCommandEventArgs e)
        {
            if (toolWindow != null)
            {
                toolWindow.Visible = true;
                return;
            }

            try {
                object   programmableObject = null;
                DTE2     application        = e.Application;
                AddIn    addInInstance      = e.Addin;
                Windows2 windows2           = (Windows2)application.Windows;
                Type     userCtrlType       = typeof(SettingsControl);
                Assembly userCtrlAssembly   = userCtrlType.Assembly;
                string   windowGuid         = "{858C3FCD-3333-4540-A592-F31C1520B174}";

                toolWindow = windows2.CreateToolWindow2(addInInstance, userCtrlAssembly.Location, userCtrlType.FullName, "CSql Settings", windowGuid, ref programmableObject);

                Type   resourcesType     = typeof(Resources);
                string imageResourceRoot = resourcesType.FullName;
                string imageResourcePath = imageResourceRoot + ".Images.Commands.Settings.bmp";
                var    icon        = new VsCommandIcon(userCtrlAssembly, imageResourcePath);
                var    iconPicture = icon.IconPicture;
                toolWindow.SetTabPicture(iconPicture);

                SettingsControl settingsControl = (SettingsControl)toolWindow.Object;
                settingsControl.SetApplication(application);

                toolWindow.Visible = true;
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message, "csql addin error");
            }
        }
示例#11
0
        internal static Window CreateToolWindow(string toolWindowClass, string caption, string guidpos)
        {
            Window found = GetWindow(caption);

            if (found != null)
            {
                found.Activate();
                LoadDataForAppropriateClass(found);
                return(found);
            }

            string assemblypath = Assembly.GetExecutingAssembly().CodeBase.Remove(0, 8);
            object ctlobj       = null;

            Windows2 wins2obj = (Windows2)ApplicationObject.Windows;
            Window   window   = wins2obj.CreateToolWindow2(
                FindAddin(ApplicationObject.AddIns),
                assemblypath,
                toolWindowClass,
                caption,
                guidpos,
                ref ctlobj);

            _omnWindows.Add(window);

            return(window);
        }
示例#12
0
        void item_Click(object sender, EventArgs e)
        {
            if (Connect.CurrentAddin == null)
            {
                return;
            }

            if (Connect.CurrentApplication == null)
            {
                return;
            }

            Connect.CurrentTable     = this.Parent.Name;
            Connect.ConnectionString = Helper.FixConnectionString(this.Parent.Connection.ConnectionString, this.Parent.Connection.ConnectionTimeout);

            try
            {
                if (!Connect.EditTracked)
                {
                    Connect.EditTracked = true;
                }

                Windows2 windows2 = Connect.CurrentApplication.Windows as Windows2;

                if (windows2 != null)
                {
                    object controlObject           = null;
                    System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();

                    string dbName = System.IO.Path.GetFileNameWithoutExtension(this.Parent.Connection.ServerName);

                    EnvDTE.Window toolWindow = windows2.CreateToolWindow2(Connect.CurrentAddin,
                                                                          asm.Location,
                                                                          "SqlCeScripter.ResultsetGrid",
                                                                          string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0} - {1}", dbName, this.Parent.Name),
                                                                          "{" + Guid.NewGuid().ToString() + "}",
                                                                          ref controlObject);

                    if (toolWindow != null)
                    {
                        toolWindow.IsFloating = false;
                        toolWindow.Linkable   = false;
                        toolWindow.Visible    = true;
                    }
                }
            }

            catch (System.Data.SqlServerCe.SqlCeException sqlCe)
            {
                Connect.ShowErrors(sqlCe);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#13
0
        public void CreateTicketWindow(ServerDetails serverDetails, TicketQueryDefinition ticketDef, string guid)
        {
            Windows2 windows2 = (Windows2)_applicationObject.Windows;
            Assembly asm      = Assembly.GetExecutingAssembly();


            object customControl = null;
            string className     = "TracExplorer.Common.TicketView";
            string caption       = ticketDef.Name;

            if (guid == null)
            {
                // Generate new guid
                guid = Guid.NewGuid().ToString("B");
            }

            string asmLocation = asm.Location;

            asmLocation = asmLocation.Replace("VSTrac.dll", "Common.dll");

            Window toolWindow = windows2.CreateToolWindow2(_addInInstance, asmLocation, className,
                                                           caption, guid, ref customControl);

            Image customToolWindowTabImage = GetCustomToolWindowTabImage();

            toolWindow.SetTabPicture(Support.ImageToIPicture(customToolWindowTabImage));

            if (customControl != null)
            {
                ((TicketView)customControl).TicketQueryUpdate += new TicketView.TicketQueryUpdateEvent(Connect_TicketQueryUpdate);
                ((TicketView)customControl).TracConnect        = this;
                ((TicketView)customControl).ServerDetails      = serverDetails;
                ((TicketView)customControl).TicketDefinition   = ticketDef;
                ((TicketView)customControl).ParentWindow       = toolWindow;
                ((TicketView)customControl).RunQuery();
            }

            toolWindow.Visible = true;

            // Add TicketWindow informations to reload window after restart
            if (_ticketWindowList == null)
            {
                _ticketWindowList = new List <TicketWindowDefinition>();
            }
            TicketWindowDefinition definition = new TicketWindowDefinition();

            definition.Guid            = guid;
            definition.ServerName      = serverDetails.Server;
            definition.TicketQueryName = ticketDef.Name;
            definition.ToolWindow      = toolWindow;

            _ticketWindowList.Add(definition);
        }
示例#14
0
        private IntPtr CreateVSWindowInternal2(string commandName, ref VSWindowHandle handle, DTE2 applicationObject, AddIn addIn)
        {
            string hostAssembly = Assembly.GetCallingAssembly().Location;

            // +Alphonso (8/14/2014)
            //
            // Note:
            // 'DocumentSite' can only be set once so if we utilize the same
            // guid for each window creation it in essence is referring to
            // the same object that has already been created and registered
            // as a COM Instance.
            //
            // The myth is that the COM Guid needs to be the same as the assembly
            // guid but I believe this is a Microsoft bug. For that reason I'm
            // commenting out this code and replacing it with a new Guid each time which
            // mimics having a separate assembly where the COM visible Guid's are different.
            //
            // Bug Fix:
            // 1 Assembly + 1 Control = Single COM+ Guid();
            // 1 Assembly + N number of Controls = New COM+ Guids();
            //const string hostAssemblyComGuid = "{F494D23E-B31E-45AB-BCA4-28865DFC2E60}";
            string hostAssemblyComGuid = Guid.NewGuid().ToString();

            object m_managedControl = null;
            IntPtr m_controlHandle  = IntPtr.Zero;

            // Create the window and then store it in our collection.
            Windows2 hwndWindows       = (Windows2)applicationObject.Windows;
            Window2  hwndWindowControl = (Window2)hwndWindows.CreateToolWindow2(
                addIn,
                hostAssembly,
                handle.ClassName,
                handle.VSWindowTitle,
                hostAssemblyComGuid,
                ref m_managedControl
                );

            hwndWindowControl.Visible = true;
            hwndWindowControl.Width   = m_stack.Pop(); // width
            hwndWindowControl.Height  = m_stack.Pop(); // height

            // Grab the managed handle of the control so we can register it
            // to receive our unmanaged window messages whenever events are raised.
            // Without this we won't be able to capture specific window events :(.
            m_controlHandle = ((System.Windows.Forms.Control)m_managedControl).Handle;
            ((IThemeControl)m_managedControl).SetTheme();

            handle.ControlHandle = m_controlHandle;
            handle.Window        = hwndWindowControl;
            handle.Control       = m_managedControl as System.Windows.Forms.Control;

            return(handle.ControlHandle);
        }
示例#15
0
        private void CreateToolWindow()
        {
            object   programmableObject = null;
            string   guidString         = "{73000449-0035-43ad-985F-A3071ECBC079}";
            Windows2 windows2           = (Windows2)_applicationObject.Windows;
            Assembly asm = Assembly.GetExecutingAssembly();

            m_toolWindow = windows2.CreateToolWindow2(_addInInstance, asm.Location,
                                                      "vsCCM.ccmControl",
                                                      "Code Complexity", guidString, ref programmableObject);
            m_toolWindow.Visible = true;

            ((ccmControl)m_toolWindow.Object).Initialize(this._applicationObject);
        }
示例#16
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)
        {
            handled = false;
            if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
            {
                if (commandName == "XnaLevelEditor.Connect.XnaLevelEditor")
                {
                    handled = true;

                    try
                    {
                        #region Load Tool Window
                        ClassManager.applicationObject = applicationObject;
                        ChooseClassForm form = new ChooseClassForm();
                        if (form.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        ClassManager classManager = new XleGenerator.ClassManager(form.ProjectName, form.ClassName, form.IsOpen);

                        object programmableObject = null;
                        guidString = "{A5431877-4E06-44FC-A59C-5BDE534A8F4F}";//{9FFC9D9B-1F39-4763-A2AF-66AED06C799E}";
                        //guidString = Guid.NewGuid().ToString("B");
                        Window window = windows2.CreateToolWindow2(_addInInstance, asm.Location,
                                                                   userControlType.FullName,
                                                                   "Level Editor", guidString, ref programmableObject);
                        MainUserControl mainUserControl = (MainUserControl)programmableObject;
                        window.IsFloating  = false;
                        window.Linkable    = false;
                        window.WindowState = vsWindowState.vsWindowStateMaximize;
                        #endregion

                        mainUserControl.ApplicationObject = applicationObject;
                        mainUserControl.Window            = window;
                        mainUserControl.IsOpen            = form.IsOpen;
                        mainUserControl._ClassManager     = classManager;
                        window.Visible = true;

                        mainUserControls.Add(window, mainUserControl);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
                    }

                    return;
                }
            }
        }
示例#17
0
 public static void CreateToolWindow(ref Window win, ref Control ctl, string guid, string classname, string caption)
 {
     if (win == null || win.Visible == false)
     {
         object   programmableObject = null;
         string   guidString         = guid;//"";
         Windows2 windows2           = (Windows2)Common.chDTE.Windows;
         Assembly asm = Assembly.GetExecutingAssembly();
         win = windows2.CreateToolWindow2(Common.chAddIN, asm.Location,
                                          classname,
                                          caption, guidString, ref programmableObject);
         win.SetTabPicture(GetTabPicture(Properties.Resources.ToolWindowBmp));
         win.Visible = true;
         ctl         = (Control)win.Object;
     }
 }
示例#18
0
        /// <summary>
        /// Initializes the plug in.
        /// </summary>
        private void InitializePlugIn()
        {
            object   programmableObject = null;
            String   guidstr            = "{858C3FCD-8B39-4540-A592-F31C1520B174}";
            Windows2 windows2           = (EnvDTE80.Windows2)_visualStudioInstance.Windows;
            Assembly asm = Assembly.GetExecutingAssembly();

            Utils.AssemblyTitle = GetAssemblyTitle(asm);
            Utils.AssemblyPath  = GetAssemblyPath(asm);

            _windowToolWindow = windows2.CreateToolWindow2(_addInInstance, asm.Location, "ReviewPal.UI.ReviewWindow",
                                                           "Review List", guidstr, ref programmableObject);

            _windowToolWindow.Visible = true;
            ReviewWindow rCommentControl = (ReviewWindow)_windowToolWindow.Object;

            rCommentControl.VisualStudioInstance = _visualStudioInstance;
        }
示例#19
0
        public override void OnExecute(VsCommandEventArgs e)
        {
            if (this.ProjectViewToolWindow == null)
            {
                object   temp    = null;
                Windows2 windows = (Windows2)e.DTE.Windows;
                this.ProjectViewToolWindow = windows.CreateToolWindow2(e.AddIn, System.Reflection.Assembly.GetExecutingAssembly().Location, "JianLi.UI.ProjectView", "项目任务", "{DD52FE78-3F3A-4c9d-8828-E78FC75B944F}", ref temp);

                ProjectView projectView = (ProjectView)temp;
                projectView.DTE          = e.DTE;
                projectView.ParentWindow = this.ProjectViewToolWindow;

                this.ProjectViewToolWindow.Visible = true;
            }
            else
            {
                this.ProjectViewToolWindow.Activate();
            }
        }
示例#20
0
        public override void OnExecute(VsCommandEventArgs e)
        {
            if (this.SolutionListViewToolWindow == null)
            {
                object   temp    = null;
                Windows2 windows = (Windows2)e.DTE.Windows;
                this.SolutionListViewToolWindow = windows.CreateToolWindow2(e.AddIn, System.Reflection.Assembly.GetExecutingAssembly().Location, "JianLi.UI.SolutionListView", "解决方案列表", "{6882BEB2-80BB-45f9-BF6F-60BC8DC77F25}", ref temp);

                SolutionListView codeOutlineView = (SolutionListView)temp;
                codeOutlineView.DTE          = e.DTE;
                codeOutlineView.ParentWindow = this.SolutionListViewToolWindow;

                this.SolutionListViewToolWindow.Visible = true;
            }
            else
            {
                this.SolutionListViewToolWindow.Activate();
            }
        }
示例#21
0
        public override void OnExecute(VsCommandEventArgs e)
        {
            if (this.solutionTagToolWindow == null)
            {
                object   temp    = null;
                Windows2 windows = (Windows2)e.DTE.Windows;
                this.solutionTagToolWindow = windows.CreateToolWindow2(e.AddIn, System.Reflection.Assembly.GetExecutingAssembly().Location, "JianLi.UI.SolutionTagView", "解决方案标签视图", "{786FD1AF-97BA-4f44-B73C-021FA6E174BC}", ref temp);

                SolutionTagView codeOutlineView = (SolutionTagView)temp;
                codeOutlineView.DTE          = e.DTE;
                codeOutlineView.ParentWindow = this.solutionTagToolWindow;

                this.solutionTagToolWindow.Visible = true;
            }
            else
            {
                this.solutionTagToolWindow.Activate();
            }
        }
        private DataPaneControl GetDataPaneControl()
        {
            if (null == _dataPaneControl)
            {
                object window = null;
                var    asm    = typeof(DataGridControl).Assembly;
                DTE2   dte2   = Locator.Get <DTE2>();
                AddIn  addIn  = Locator.Get <AddIn>();

                Windows2 w = (Windows2)dte2.Windows;

                if (null == _toolWindow)
                {
                    try
                    {
                        _toolWindow = w.Item(DataPaneControl.Guid);
                        window      = _toolWindow.Object;
                    }
                    catch
                    {
                    }

                    if (null == _toolWindow)
                    {
                        _toolWindow = w.CreateToolWindow2(
                            addIn,
                            asm.Location,
                            typeof(DataPaneControl).FullName,
                            "StudioShell Data Panes",
                            DataPaneControl.Guid,
                            ref window);
                    }
                    if (null == _toolWindow || null == window)
                    {
                        Debug.Assert(false, "unable to locate data pane tool window");
                    }
                }

                _dataPaneControl = (DataPaneControl)window;
            }
            return(_dataPaneControl);
        }
        /// <summary>
        /// Show WindowPane for jiraconn
        /// </summary>
        public static void ActivateWindowPane(string assemblyLocation, string progId, string title)
        {
            if (toolWindow == null)
            {
                Windows2 toolWins = (Windows2)applicationObject.Windows;

                object objTemp = null;

                // Create a new tool window, embedding the
                // LineCounterBrowser control inside it...
                toolWindow = toolWins.CreateToolWindow2(
                    addInInstance,
                    assemblyLocation,
                    progId,
                    title,
                    guidToolWindow, ref objTemp);

                toolWindow.Visible = true;
            }
        }
示例#24
0
        private void createIssueDetailsWindow()
        {
            try
            {
                const string guid = "{0D8A8CD2-1B6F-4efe-AB9B-B295A59CB76F}";

                object   obj          = null;
                Windows2 windows2     = (Windows2)applicationObject.Windows;
                string   loc          = Assembly.GetExecutingAssembly().Location;
                Window   issuesWindow = windows2.CreateToolWindow2(
                    addInInstance, loc, "PaZu.IssueDetailsWindow", "Issues - JIRA", guid, ref obj);

                IssueDetailsWindow.Instance.WindowInstance = issuesWindow;

                issuesWindow.Visible = false;
            }
            catch (Exception e)
            {
                MessageBox.Show("Creation of the issue details window failed \n\n" + e);
            }
        }
示例#25
0
        //////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Create a view of the addin
        /// The view should be a UserControl which will be created directly
        /// embedded within the Window representing the AddIn in VisualStudio.
        /// the Window container of the Addin on screee,
        /// </summary>
        /// <param name="addInApplication"></param>
        /// <param name="addInInstance"></param>
        /// <param name="addInView"></param>
        /// <param name="viewGuid"></param>
        /// <param name="viewCaption"></param>
        /// <param name="viewClass"></param>
        /// <param name="viewIcon"></param>
        /// <returns></returns>
        //////////////////////////////////////////////////////////////////////////

        public static Window CreateAddinView(DTE2 addInApplication, AddIn addInInstance, ref object addInView, string viewGuid, string viewCaption, Type viewClass, Bitmap viewIcon)
        {
            Windows2 dteWindows  = (Windows2)addInApplication.Windows;
            Window   addInWindow = dteWindows.CreateToolWindow2(addInInstance, viewClass.Assembly.Location, viewClass.FullName, viewCaption, viewGuid, ref addInView);

            if (addInWindow != null)
            {
                // Set the tab icon
                if (viewIcon != null)
                {
                    StdPicture tabPicture = AddInUtils.CreatePicture(viewIcon);
                    addInWindow.SetTabPicture(tabPicture);
                }

                addInWindow.Linkable   = true;
                addInWindow.IsFloating = false;
                addInWindow.Activate();
            }

            return(addInWindow);
        }
示例#26
0
        /// <summary>
        /// Creates a page viewer window with a given connection string and page address
        /// </summary>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="pageAddress">The page address.</param>
        /// <returns></returns>
        public PageViewerContainer CreatePageViewerWindow(string connectionString, RowIdentifier rowIdentifier)
        {
            Guid id = Guid.NewGuid();

            Windows2 windows2 = applicationObject.Windows as Windows2;

            if (windows2 != null)
            {
                object   controlObject = null;
                Assembly asm           = Assembly.GetExecutingAssembly();

                Window toolWindow = windows2.CreateToolWindow2(this.addInInstance,
                                                               asm.Location,
                                                               "InternalsViewer.SSMSAddIn.PageViewerContainer",
                                                               "Page Viewer " + rowIdentifier.PageAddress.ToString(), "{" + id.ToString() + "}",
                                                               ref controlObject);

                // Make the window a tabbed document
                toolWindow.Linkable   = false;
                toolWindow.IsFloating = false;

                PageViewerContainer pageViewerContainer = (controlObject as PageViewerContainer);

                pageViewerContainer.Window        = toolWindow;
                pageViewerContainer.WindowManager = this;

                pageViewerContainer.PageViewerWindow.LoadPage(connectionString, rowIdentifier);

                toolWindow.Visible = true;

                pageViewerContainer.PageViewerWindow.SetSlot(rowIdentifier.SlotId);

                return(pageViewerContainer);
            }
            else
            {
                return(null);
            }
        }
示例#27
0
        /*
         * CreateToolWindow
         */

        private Window CreateToolWindow(AddIn addIn, Type toolWindowType, string toolWindowCaption)
        {
            Debug.Assert(addIn != null, "addIn != null");
            Debug.Assert(toolWindowType != null, "toolWindowType != null");

            Window toolWindow = null;

            object   controlObject = null;
            Windows2 toolWindows   = (Windows2)_applicationObject.Windows;

            toolWindow = toolWindows.CreateToolWindow2(
                addIn,
                Assembly.GetExecutingAssembly().Location,
                toolWindowType.FullName,
                toolWindowCaption,
                "{7ED46EA6-8E0D-4116-ABFE-0EEED142BF1E}",
                ref controlObject
                );

            Debug.Assert(toolWindow != null, "toolWindow != null");
            Debug.Assert(controlObject is NuGenTaskListUI, "controlObject is NuGenTaskListUI");

            _taskListUI       = (NuGenTaskListUI)controlObject;
            _taskListUI.DTE   = _applicationObject;
            _taskListUI.Load += _TaskListUI_Load;

            toolWindow.SetTabPicture(Resources.ToolWindow_TaskList.GetHbitmap());

            /* It is necessary to set the value of the Visible property to true; otherwise,
             * exceptions are thrown.
             */
            toolWindow.Visible = true;

            toolWindow.Width  = 250;
            toolWindow.Height = 200;

            return(toolWindow);
        }
示例#28
0
        private void ShowDeploymentProperties()
        {
            string guidStr = "{426E8D27-3D33-4fc8-B3E9-9883AADC679F}";
            object objTemp = null;


            string projPath = ProjectPath;
            string execAsm  = Assembly.GetExecutingAssembly().Location;


            Windows2 wins = (Windows2)_app.Windows;

            try {
                if (!isToolWin)
                {
                    toolWin             = (Window2)wins.CreateToolWindow2(_addIn, execAsm, "DeployAddIn.DepProp", "Deployment Properties", guidStr, ref objTemp);
                    toolWin.IsFloating  = false;
                    toolWin.Linkable    = false;
                    propForm            = (DepProp)objTemp;
                    propForm.AutoScroll = true;
                    //propForm.Init(projPath);
                    isToolWin = true;
                }

                propForm.Init(ProjectPath);
                if (wins == null)
                {
                    toolWin.Visible = true;
                }

                //toolWin.Activate();
                toolWin.Visible = true;
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
        }
示例#29
0
        private void InitializeInternalConsole(ResourceManager resourceManager)
        {
            object   windowControlObj = null;
            Assembly asm     = typeof(PSTextBox).Assembly;
            Windows2 windows = (Windows2)_applicationObject.Windows;

            if (null == _toolWindow)
            {
                _toolWindow = (Window2)windows.CreateToolWindow2(
                    _addInInstance,
                    asm.Location,
                    typeof(PSTextBox).FullName,
                    "StudioShell",
                    ToolWindowGuid,
                    ref windowControlObj);
                _consoleControl = (PSTextBox)windowControlObj;

                var image = resourceManager.GetObject("1") as Image;
                _toolWindow.SetTabPicture(ImageAdapter.ToIPictureDisp(image));
            }

            if (null != _toolWindow)
            {
                _toolWindow.Visible = true;

                //HACK: vs2010 uses a container window that does not automagically size the control window,
                //  so we have to force a WM_WINDOWPOSCHANGED message to set up the initial control dock state
                _consoleControl.Height += 1;
            }

            _consoleControl.ClearBuffer();

            if (null == Shell)
            {
                InitializeShell();
            }
        }
示例#30
0
        /// <summary>
        /// Creates the allocation window.
        /// </summary>
        /// <returns></returns>
        public DecodeContainer CreateDecodeWindow()
        {
            Guid id = new Guid("{fd35b1e4-c1ca-4b63-8be5-0b005a6def4d}");

            Windows2 windows2 = applicationObject.Windows as Windows2;

            if (windows2 != null)
            {
                object   controlObject = null;
                Assembly asm           = Assembly.GetExecutingAssembly();

                Window toolWindow = windows2.CreateToolWindow2(this.addInInstance,
                                                               asm.Location,
                                                               "InternalsViewer.SSMSAddIn.DecodeContainer",
                                                               "Internals Viewer", "{" + id.ToString() + "}",
                                                               ref controlObject);


                toolWindow.Visible = true;

                if (toolWindow.IsFloating)
                {
                    toolWindow.Width  = 376;
                    toolWindow.Height = 135;
                }

                toolWindow.Caption = "Decode and Find";

                this.decodeContainer = controlObject as DecodeContainer;

                return(this.decodeContainer);
            }
            else
            {
                return(null);
            }
        }