Tuesday, May 17, 2011

Writing into Visual Studio Output Window. Part 2


In Part 1 we set up OutputWindowWriter class which performs writing to the Visual Studio output window. What else can we add here?
It would be great if everything worked fine from the first attempt, but this not always happens, especially when dialing with someone’s else code. In our situation we have problem - when output window is initially hidden (by auto hide option at the top right corner of the window next to the cross) and we are writing something there we may get something like this
image

Sunday, May 1, 2011

Selecting first item in WPF ListView and keyboard navigation

I have been playing with WPF ListView recently and I’ve met its following not quite
comfortable behavior – when ListView is focused and I’m trying to navigate inside it using keyboard (in my case it was down arrow) I had to press down key twice to move to the second item and then once for each next item. My goal was to fix that twice pressing (and also enable correct navigation when some other item is selected, not the first one). I thought that it can be archieved by some simple property like SelectedIndex, but despite setting it to necessary value it still didn’t work.

Tuesday, April 12, 2011

Writing into Visual Studio Output Window. Part 1


Lets assume that we have some Visual Studio 2010 Isolated Shell application (I suppose everything mentioned here should be valid for ordinary vspackages, but didn’t test, so cannot be sure). It may perform some operations (actually it is usually written to perform some operation, isn’t it?) and our task is to put log of these operations somewhere. Visual Studio has such nice feature like output window. And it is perfect candidate for such log, so post creates simple class to make it easy to write anything into log.

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