Condividi tramite


Writing a SideShow-enabled Sidebar gadget

Did you know that you can write a single gadget that works on both Windows Sidebar andWindows SideShow-enabled devices?  It's unfortunate that we don't publicize this technology as much as we should, and so that's what I want to share with you today.  Writing a combined gadget, as we call them, requires about 110% of the effort (not scientifically measured) required to write just a gadget for Windows Sidebar.  Due to differences in how content is rendered on the desktop (JScript, HTML) and on the devices (Simple Content Format), we don't have any sort of automatic translation between the two (note: any enterprising developers want to build this?).  What that means is that you have to "render" your data twice--but that's easy, since the hard part is typically just getting access to the data in the first place!

If you're currently writing a Sidebar gadget, I urge you to add SideShow support as well.  It's easy, it can differentiate and add tremendeous value to your gadget, and it allows you to reach your users beyond just the desktop.  To get started, you'll want to review the methods on the System.Gadget.SideShow object, which is the main API used to extend Sidebar gadgets to Windows SideShow-enabled devices.  You'll also want to review the MSDN document "Extending a Windows Sidebar gadget to Windows SideShow."

Of course, as all developers appreciate, the real documentation is in the code.  We've actually had sample code for a long time, but no one really knew it!  Windows Vista includes a Stocks gadget for Windows Sidebar; well, we decided to take this gadget, extend it to support Windows SideShow, and make it available on the SideShow portion of the Windows Live Gallery.  If you're curious just how you would extend your gadget to work with Windows SideShow, download our Stocks gadget (it's called "StocksPlus" in the gadget picker) and look at the source code.  Specifically, the sideshow.js file.  That's where all the magic happens.  Oh, and if you don't happen to have a Windows SideShow-compatible device handy, you can find a software Simulator in the Windows SDK.

Now that you're excited about the potential opportunities and have decided to take the plunge, I want to bring your attention to this post which covers some very important information regarding the API that didn't quite make it into the documentation.  Please give it a read if you'ore going to build a gadget--it will make the experience much better!  I also want to point out that the folks over at WeatherBug have also SideShow-enabled their Sidebar gadget, which you can also get at the Gallery.

Of course, if you have any questions on this, head over to our Windows SideShow Development forum on MSDN and ask away!

- Dan