/// <summary> /// Shows (or creates if needed) the specified tool window. /// </summary> public bool ShowToolWindow(IPackageToolWindow toolWindow) { Window t; Control c; if (!toolWindows.TryGetValue(toolWindow, out t) || t == null) { c = ((IToolCreator)this).CreateToolWindow(toolWindow) as Control; toolWindow.Control = c; if (c != null) { c.Text = toolWindow.Caption; toolWindow.Window.Visible = true; // store for future usage: toolWindows.Add(toolWindow, toolWindow.Window); return(true); } Trace.WriteLine("Error during creation of tool-window form."); return(false); } t.Visible = true; return(false); //ShellHelper.ShowToolWindow(toolWindow.ToolWindowPaneType, assist, false, false); }
/// <summary> /// Standard constructor for the tool window. /// </summary> public BaseToolWindowPane() : base(null) { tool = new T(); Caption = tool.Caption; BitmapResourceID = tool.BitmapResourceID; BitmapIndex = tool.BitmapIndex; }
protected override void Dispose(bool disposing) { if (tool != null) { tool.Destroy(); tool = null; } base.Dispose(disposing); }
object IToolCreator.CreateToolWindow(IPackageToolWindow tool) { if (tool == null || tool.ControlType == null) { return(null); } object objToolWindow = null; Type type = tool.ControlType; string guid = tool.Guid; // force the proper format of the GUID: if (!string.IsNullOrEmpty(guid) && guid[0] != '{' && guid[guid.Length - 1] != '}') { guid = "{" + guid + "}"; } try { // create a new tool window, embedding the control inside it ActiveX host... Window2 window = ((Windows2)appObject.Windows).CreateToolWindow2(addInInstance, type.Assembly.Location, type.FullName, tool.Caption, guid, ref objToolWindow) as Window2; if (objToolWindow == null) { objToolWindow = LastCreatedPackageTool; lastCreatedPackageTool = null; } // validate created window-frame: if (window == null) { return(null); } // set proper icon retrieved from resources: if (tool.BitmapIndex > 0) { Bitmap tabIcon = LoadImage(tool.BitmapIndex.ToString()); // set the tab-picture image: ImageHelper.SetTabPicture(window, tabIcon); } // make the window a document inside the IDE: try { window.Linkable = false; } catch (Exception ex) { Trace.Write(ex.Message); } try { window.IsFloating = false; } catch (Exception ex) { Trace.Write(ex.Message); } // remember reference: tool.Window = window; } catch (Exception ex) { Trace.Write(ex.Message); } return(objToolWindow); }
/// <summary> /// Initializes a new instance of the <see cref="OpenGuidanceExplorerCommand"/> class. /// </summary> /// <param name="toolWindow">The tool window.</param> internal OpenGuidanceExplorerCommand(IPackageToolWindow toolWindow) { this.toolWindow = toolWindow; }
/// <summary> /// Initializes a new instance of the <see cref="OpenSolutionBuilderCommand"/> class. /// </summary> /// <param name="toolWindow">The tool window.</param> internal OpenSolutionBuilderCommand(IPackageToolWindow toolWindow) { this.toolWindow = toolWindow; }
/// <summary> /// Initializes a new instance of the <see cref="OpenGuidanceExplorerMenuCommand"/> class. /// </summary> /// <param name="toolWindow">The tool window.</param> public OpenGuidanceExplorerMenuCommand(IPackageToolWindow toolWindow) : base(new OpenGuidanceExplorerCommand(toolWindow), CommandGroup, CommandId) { }
/// <summary> /// Initializes a new instance of the <see cref="OpenSolutionBuilderMenuCommand"/> class. /// </summary> /// <param name="toolWindow">The tool window.</param> public OpenSolutionBuilderMenuCommand(IPackageToolWindow toolWindow) : base(new OpenSolutionBuilderCommand(toolWindow), CommandGroup, CommandId) { }