📜 ⬆️ ⬇️

Visual Studio 2010 in Windows 7 Taskbar

Recently, a new Eclipse Helios has been released, among the innovations of which there is support for the Windows 7 taskbar and the Mac OS X dock. In particular, Eclipse can display build progress, errors and warnings. You quickly get used to good things, and I wanted to have something similar in Visual Studio 2010. There was no suitable extension on the network, so I had to do it myself.

I have never written plugins to VS before, but on the Microsoft website there was also an SDK and a lot of information on it. To work with the new taskbar in .Net there is also a ready-made set of libraries and examples: Windows API Code Pack .

Technical details


After creating the “Visual Studio Add-in” template project, all that remains is to fill in the following methods with code:
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
public void OnStartupComplete(ref Array custom)
public void OnBeginShutdown(ref Array custom)


I used the first three:

Check for support of the taskbar looks like this:
if (!TaskbarManager.IsPlatformSupported)
{
MessageBox.Show("Win7taskbar plugin requires to be run on Windows 7", "Plugin needs Windows 7", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

')
Interfaces _applicationObject.Events.BuildEvents, _applicationObject.Events.DebuggerEvents, _applicationObject.Events.SolutionEvents provide a set of events to learn about the start / end of the assembly, the transition to debug mode and the opening / closing of the session.
You can get a list of studio errors and warnings via _applicationObject.ToolWindows.TaskList

How to work with the taskbar, I learned from the wonderful guide here . The rest was a trick.

What happened


Now, when I build, I see a progress indicator (unfortunately, the studio does not report the percentage of completion):

If at the time of the end of the assembly there are warnings or errors, one of the icons appears in the taskbar:


In addition, since I often open three or four studio copies, I also decided to add a ThumbnailToolbar for the “Build Solution”, “Debug” and “Run” actions:


Conclusion


I packed the resulting result in msi and uploaded it to the Visual Studio Gallery , and its just files in a zip-archive , just in case I uploaded it on narod.ru.
It works for me, I hope for you too! ;)

Source: https://habr.com/ru/post/97557/


All Articles