Recently I entered a Gadget Competition hosted by MSOZACADEMIC and Si-Mi. The competition was announced on the MSOZACADEMIC blog and on the MSDN Flash. I do subscribe to the Flash but I did not see this competition during my skim of the newsletter. Fortunately, my work mate highlighted this for me. I thought it would be a good way for me to try out Sidebar Gadget programming and motivation to actually finish a home project. The competition closed at 23.59pm 31st October 2007 and to my surprise I had completely finished and upload my gadget a whole 4 days ahead of the closing date. To my delight my Auto Lock gadget was name Judges Choice. In the post Nick Ellery mentioned that he had seen a tutorial on this before. My prizes arrived today, so I thought it was about time to detail how I put together the gadget.
The tutorial that I was inspired by was on the MSDN Coding4Fun blog. The post was Bluetooth Screen Lock and demonstrated the use of the managed wrappers for the Coding4Fun Developer Toolkit which was still in Beta. This gave me a huge base to start off. I pulled open the toolkit and extracted just the relevant Bluetooth communications wrapper. Guided by the Bluetooth Screen Lock code, I then built a single .NET DLL exposing just the functions required to communicated to Bluetooth devices and Lock the computer. Then came what I thought would be the simpler task. Build an interface as a Vista Sidebar gadget and call the functions. Building the interface was fine, but calling the functions wasn’t so straight forward. Two steps are required to make this happen.
public class AutoLock
Now to go play with the new toys.