Beispiel #1
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method is used to show the solution designer window.</summary>
        ///--------------------------------------------------------------------------------
        private void ShowSolutionDesignerWindow()
        {
            try
            {
                // Get the instance number 0 of this tool window. This window is single instance so this instance
                // is actually the only one.
                SolutionDesignerWindow window = this.FindToolWindow(typeof(SolutionDesignerWindow), 0, false) as SolutionDesignerWindow;
                if (window == null)
                {
                    window = this.CreateToolWindow(typeof(SolutionDesignerWindow), 0) as SolutionDesignerWindow;
                    if ((null == window) || (null == window.Frame))
                    {
                        throw new NotSupportedException(Resources.CanNotCreateWindow);
                    }
                }

                // dock the window as an mdi child, user can override
                IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
                ((IVsWindowFrame)window.Frame).SetProperty((int)__VSFPROPID.VSFPROPID_FrameMode, VSFRAMEMODE.VSFM_MdiChild);
                Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
            }
            catch (System.Exception ex)
            {
                Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Error showing solution designer: {0}", ex.ToString()));
                // put exception message in output pane
                SolutionBuilderPane.OutputString(ex.Message);
            }
        }
Beispiel #2
0
 ///--------------------------------------------------------------------------------
 /// <summary>This method determines if visual studio can close.</summary>
 ///--------------------------------------------------------------------------------
 public int get_CanClose(out bool pfCanClose)
 {
     pfCanClose = true;
     try
     {
         // cancel close if either solution designer or solution builder cannot close
         SolutionDesignerWindow solutionDesigner = this.FindToolWindow(typeof(SolutionDesignerWindow), 0, false) as SolutionDesignerWindow;
         if (solutionDesigner != null)
         {
             if (solutionDesigner.CanClose() == false)
             {
                 pfCanClose = false;
                 return(VSConstants.E_ABORT);
             }
             solutionDesigner.Control.DesignerView.CloseNoPromptAllItems();
             IVsWindowFrame windowFrame = (IVsWindowFrame)solutionDesigner.Frame;
             windowFrame.Hide();
         }
         SolutionBuilderWindow solutionBuilder = this.FindToolWindow(typeof(SolutionBuilderWindow), 0, false) as SolutionBuilderWindow;
         if (solutionBuilder != null)
         {
             if (solutionBuilder.CanClose() == false)
             {
                 pfCanClose = false;
                 return(VSConstants.E_ABORT);
             }
             solutionBuilder.Control.CloseAllSolutions(true);
             IVsWindowFrame windowFrame = (IVsWindowFrame)solutionBuilder.Frame;
             windowFrame.Hide();
         }
     }
     catch (System.Exception ex)
     {
         // put exception message in output pane
         SolutionBuilderPane.OutputString(ex.Message);
     }
     return(VSConstants.S_OK);
 }