"Daddy is Working" Light


Looking for a fun little project? Work at home? Wish you had an "on the air" kind of light that's instead tied to Visual Studio?

Kirk Evans did too...

Blynclight for Developers–Daddy is Working Light

This post will show you how to code a custom Visual Studio VSIX add-in that will control a USB light, turning the light the color of your choice when Visual Studio is in the foreground or actively debugging. 

The code is available for download at https://github.com/kaevans/BlyncLightAddin


A few years ago, Andrew Connell and Scott Hanselman posted about getting a USB presence indicator for Lync (Lync + BusyLight = Great Solution for the Home Office, Is Daddy on a call? A BusyLight Presence indicator for Lync for my Home Office).  I received a Blynclight as a speaker gift for speaking at a conference a few years ago and it’s just sat on my desk, turning various colors as my Skype for Business presence changes. 

Blynclight Standard


Download the SDK

I downloaded the Blynclight SDK from the Blynclight Developer Forum (http://blynclight.proboards.com/thread/2/blync-sdk-create-own-applications).  It required registration in order to download the SDK, but once you download it you can see the binaries, a sample application, and a Word doc that contains information on the API.


Create a Custom Tool Window

Once you have the extensibility tools installed (Visual Studio prompts you to install these if you haven’t already), create a new VSIX project in Visual Studio.


Add Blynclight Functionality

Now that the shell of our add-in is working, we can create our custom tool window.  You previously downloaded the SDK which includes Blynclight.dll.  This file is not signed, so you won’t be able to load it.  However, there is a workaround as shown in the post Sign a .NET Assembly with a Strong Name Without Recompiling.  You basically create a strong-named key using sn.exe, disassemble the DLL to intermediate language (IL) using ILDASM.exe, then assemble the IL into a DLL including your strong-named key using ILASM.exe.


Is Visual Studio the Active Window?

If I have Visual Studio open, I usually don’t want to be disturbed.  We can cheat this by registering for a callback any time the active window is changed.  Once changed, we can look at the title of the window and decide if we want to change the light’s color or not. Registering the callback is very simple, especially when someone on Stack Overflow has done the hard lifting for us!  See the post Detect active window changed using C# without polling.  I’ll be the first to admit, this is an amateurish approach to just look for a hard-coded string “Microsoft Visual Studio”… but that’s the beauty of open source, right?  Just fork the repo and implement the rest that I was too lazy to finish.


Is Visual Studio Debugging?

This one was a little harder to solve, but turned out so much easier to implement.  I wanted to know if Visual Studio was actively debugging something.  If it is, then changing windows doesn’t matter (debugging usually means that new windows are popping up all over the place), just show the status as busy. 



This was cathartic for me.  I really just wanted to know how to code a VSIX extension and to spend some time in Visual Studio doing something other than Azure.  I coded this in about a day (gotta love editor inheritance from Stack Overflow). 

... [Check out the whole post]

The Discussion

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.