"Ghost Pane" left after removing windows from DTE
-
Tuesday, March 10, 2009 4:00 PM
Hello all,
I am attempting to programmatically simplify the DTE by removing all windows and toolbars. I am having two issues with this
1) Once all the windows are removed a "ghost pane" stays up on the right side where the Solution Explorer and Properties windows were originally. There are no controls on this pane so I cannot remove it manually and am unsure how to access it programmatically. This only happens the first time- the second time through the pane is gone.
==> How can I get rid of this pane on the first run?
2) Some windows which are up but not visible are not showing up in the DTE.Windows property, these include the Toolbar (autohide = true) and the Data Sources (comes up behind the Project/Solution Explorer). I have to look for the toolbar individually to get at it and I have to run the CloseAllWindows (see code below) code twice to remove the Data Sources Window.
==> Is there a better way to get all the windows closed?
Any help would be much appriciated.private void SimplifyIDE(DTE devEnv) { //get the commanad bars CommandBars allCommandBars = (CommandBars)devEnv.CommandBars; //hide the standard bar allCommandBars["Standard"].Visible = false; //disable the menu bar allCommandBars["MenuBar"].Enabled = false; //disable the debugging bar allCommandBars["Debug"].Enabled = false; //hide all windows var windows = from Window elem in devEnv.Windows where elem.Visible == true select elem; while (windows.Count() >= 1) CloseAllWindows(devEnv); } private void CloseAllWindows(DTE devEnv) { //turn off toolbar Window toolbox = devEnv.Windows.Item(EnvDTE.Constants.vsWindowKindToolbox); if (toolbox != null) toolbox.Close(vsSaveChanges.vsSaveChangesNo); //get the visible windows var windows = from Window elem in devEnv.Windows where elem.Visible == true select elem; //close all windows until no more are visible while (windows.Count() >= 1) { foreach (Window win in devEnv.Windows) { try { win.Close(vsSaveChanges.vsSaveChangesNo); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Unable to make window invisible " + win.Caption + "/n" + ex.ToString()); } } }
Thanks,
-Melody
Melody @ Summsoft
All Replies
-
Tuesday, March 17, 2009 12:07 PM
Hi Melody,
>About "ghost pane"
I can reproduce this issue with your steps and this behavior only happen after I rebuild the addin and run the addin without closing and reopening the Visual Studio, if I close the Visual Studio and open it again, there is no such issue. When deploying this addin, I think, there is no such problem. You can also submit this issue on our Connect portal site.
https://connect.microsoft.com/VisualStudio/In your feedback, you can quote the URL to this thread, so that the whole conversation can be available. Every feedback submitted will be evaluated carefully by our engineers. They will let you know their comments further through that portal. It would be great if you can also paste the link to the submitted feedback here, so that other community members can see it as well.
>The second question
I cannot repro this issue, could you please provide more detailed background?
Thanks,
Rong-Chun Zhang
Please mark the replies as answers if they help and unmark if they don't.
Welcome to the All-In-One Code Framework, a sample code project owned by the MSDN Forum Support team!- Marked As Answer by Rong-Chun Zhang Thursday, March 19, 2009 3:28 AM
-
Thursday, April 02, 2009 7:16 PM
Rong-Chun,
Thanks for looking into this. Here is the reply from the bug submission.
From Enzhou Wang:
A simple way to work around it seems to be to move the close-window-call to the beginning:
//hide all windows- call until no more visible windows var windows = from Window elem in devEnv.Windows where elem.Visible == true select elem; while (windows.Count() >= 1) CloseAllWindows(devEnv);
For example,
private void SimplifyIDE(DTE devEnv) { try { //hide all windows- call until no more visible windows var windows = from Window elem in devEnv.Windows where elem.Visible == true select elem; while (windows.Count() >= 1) CloseAllWindows(devEnv); //get the commanad bars CommandBars allCommandBars = (CommandBars)devEnv.CommandBars; //hide the standard bar allCommandBars["Standard"].Visible = false; //disable the menu bar allCommandBars["MenuBar"].Enabled = false; //disable the debugging bar allCommandBars["Debug"].Visible = false; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error in SimplifyIDE " + ex.ToString()); } }
Melody @ Summsoft

