///-------------------------------------------------------------------------------- /// <summary>This method displays a message in the output area.</summary> /// /// <param name="outputMessage">The message to show.</param> /// <param name="outputTitle">The title for the message.</param> /// <param name="appendMessage">Flag indicating whether message should be appended to existing message.</param> ///-------------------------------------------------------------------------------- public void ShowOutput(string outputMessage, string outputTitle, bool appendMessage) { if (appendMessage == false) { // clear output pane SolutionBuilderPane.Clear(); } if (outputTitle != string.Empty) { // put output title to output pane SolutionBuilderPane.OutputString("\r\n" + outputTitle); } // put output message to output pane SolutionBuilderPane.OutputString("\r\n" + outputMessage + "\r\n"); }
///-------------------------------------------------------------------------------- /// <summary> /// This function is called when the user clicks the menu item that shows the /// tool window. See the Initialize method to see how the menu item is associated to /// this function using the OleMenuCommandService service and the MenuCommand class. /// </summary> ///-------------------------------------------------------------------------------- private void ShowSolutionBuilderWindow(object sender, EventArgs e) { try { // show solution builder SolutionBuilderPane.Clear(); // Get the instance number 0 of this tool window. This window is single instance so this instance // is actually the only one. // The last flag is set to true so that if the tool window does not exists it will be created. SolutionBuilderWindow window = this.FindToolWindow(typeof(SolutionBuilderWindow), 0, false) as SolutionBuilderWindow; if (window == null) { window = this.CreateToolWindow(typeof(SolutionBuilderWindow), 0) as SolutionBuilderWindow; if ((null == window) || (null == window.Frame)) { throw new NotSupportedException(Resources.CanNotCreateWindow); } } // wire up solution builder window events window.Control.ProgressChanged -= SolutionBuilderControl_ProgressChanged; window.Control.ProgressChanged += new SolutionBuilderControl.StatusChangeEventHandler(SolutionBuilderControl_ProgressChanged); window.Control.StatusChanged -= SolutionBuilderControl_StatusChanged; window.Control.StatusChanged += new SolutionBuilderControl.StatusChangeEventHandler(SolutionBuilderControl_StatusChanged); window.Control.OutputChanged -= SolutionBuilderControl_OutputChanged; window.Control.OutputChanged += new SolutionBuilderControl.StatusChangeEventHandler(SolutionBuilderControl_OutputChanged); window.Control.OpenOutputSolutionRequested -= SolutionBuilderControl_OpenOutputSolutionRequested; window.Control.OpenOutputSolutionRequested += new SolutionBuilderControl.SolutionEventHandler(SolutionBuilderControl_OpenOutputSolutionRequested); window.Control.ShowSolutionDesignerRequested -= SolutionBuilderControl_ShowSolutionDesignerRequested; window.Control.ShowSolutionDesignerRequested += new SolutionBuilderControl.SolutionEventHandler(SolutionBuilderControl_ShowSolutionDesignerRequested); // show designer window ShowSolutionDesignerWindow(); // show getting started help if (window.Control.DataContext is BuilderViewModel) { (window.Control.DataContext as BuilderViewModel).ResourcesFolder.ShowGettingStartedHelp(); } // TODO: remove this later window.DesignerWindow = this.FindToolWindow(typeof(SolutionDesignerWindow), 0, false) as SolutionDesignerWindow; // if solution is already open, load it CheckOpenCurrentSolution(); IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); // put solution builder output to output pane SolutionBuilderPane.OutputString("Solution Builder shown."); } catch (System.Exception ex) { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Error showing solution builder: {0}", ex.ToString())); // put exception message in output pane string message = ex.Message; System.Exception exception = ex.InnerException; while (exception != null) { message += "\r\n" + exception.Message; exception = exception.InnerException; } SolutionBuilderPane.OutputString(message); } }