This post has been republished via RSS; it originally appeared at: Channel 9.
When you're a dev and you've just got a cool new input device, what is the first thing you do?
Nico Vermeir shares the first thing he did, taking his shiny new Surface Dial and connecting it to Visual Studio, making it a debug dial... :)
Using the Surface Dial as a debug tool
The Surface Dial is a nifty little device, it feels great and can add some nice capabilities to your apps. However, the very best thing about it is that is has an API. I had a go with it and decided to try and turn the dial into a debugging device.
The Dial has a few gestures. It’s a button that you can press, and it rotates clockwise and counter-clockwise. My goal was to start a debugging session by clicking the Dial, Step-Over (F10) by rotating clockwise and Step-Into (F11) by rotating counter-clockwise.
We’ll need some stuff to get going:
- Surface Dial
- Visual Studio 2015 (any edition is fine)
- Visual Studio 2015 SDK (included in the Visual Studio Installer)
- Windows 10 Anniversary Update or later
Setting up a Visual Studio Extension...
Connecting to the Dial....
Gluing it together...
From the args we get the rotation delta, one step on the rotator is a delta of 10, +10 clockwise and –10 counter-clockwise.
And that’s it, build it in release mode and the bin/release folder will contain a .vsix installer file. Close VS, install the extension, reopen VS, open a solution, select Debug from the radial menu and debug away!
The source code is on GitHub. Here’s a link to the compiled VSIX file.
Disclaimer: the code is provided as-is. I do not plan to publish this on the gallery or maintain the project. Do feel free to pick this up and create an open-source project from it (would be nice to include a reference to this post in the description)