Thursday, March 31, 2011

Visual Studio Isolated Shell: ToolWindowPane close and its detection

Currently I'm using C# every day. And sometimes I'm coming across situation when solution isn't obvious or easy for me to find. Maybe I’ve just used wrong keywords when performed my search queries but I still hope that this can be useful for someone (at least for me to remember those things and recall them if necessary in the future). I'm going to post such situations here (maybe not only them in the future, but currently it is the main idea of this blog). And since I’ve been working with Visual Studio 2010 Isolated Shell recently, I’m going to start with it.

Here it is the first problem.

What do we have? We have package for VS (Visual Studio) 2010 Isolated Shell mode. It was created for custom project type in VS 2005 then it was migrated to VS 2008 and then changed to support VS 2010 Isolated Shell.

What should we do? One of the tasks was to create wizard based on Microsoft.VisualStudio.Shell.ToolWindowPane. This wizard should query user for some data and create appropriate files after it finishes.


Obviously we should have ability to
  1. Close window when user presses Finish or Cancel buttons
  2. Detect when user closes the wizard