Wednesday, August 19, 2009

Today at the Wellington .NET User Group, Kevin presented a talk on "Windows Mobile 6.5 Widgets".

Kevin has kindly provided his slides and samples for download:

I found this interesting. I haven't developed any applications for Windows Mobile, though I have played around a bit with the emulator and deploying code from within Visual Studio.

Widgets seem like a lot simpler application development model than native or compact framework applications. The application development model is similar to Vista sidebar gadgets, as there is a packaged zip file containing the application inside - and the application is 'simply' Javascript and HTML. Widgets can use XHR or DOM manipulation, and have access to a small amount of local storage to store preference information.

Windows Mobile 6.5 treats widgets as first-class application citizens within the OS - they have icons on the revamped start screen, and appear in the uninstall screen. As far as the user knows, they are the same as a native application.

Where the process is currently let down is in deployment and debugging. Currently a widget can only be deployed through the Windows Mobile marketplace, after the developer has signed up and the application has been reviewed (I think!). Debugging from Visual Studio seems non-existent, meaning that development is through trial and error.

I could see an enterprising person (like Kevin) building a Javascript library that simulated the API provided by the widget infrastructure, so that widgets could be developed and tested on a desktop before being deployed on a device. Kevin, am I right that all that is needed is the Widget object and some fake ActiveX controls?

All up, an interesting session.



Thursday, August 20, 2009 11:30:49 AM (New Zealand Standard Time, UTC+12:00)
Considering my opinion of JavaScript, don't hold your breath :-)

If we wanted to implement something like this though I'd expect something like the following:
1) Conditional comments in the HTML around the script links (since you obviously wouldn't want to load or for that matter include these dummy definitions on the device or emulator)
2) A singleton object defined for "widget". I think defining the persistence methods (without persistence beyond the lifetime of the session) would be easy enough, and widget.createObject could be a factory method (return either custom objects or COM objects depending on what was requested), but Menu and MenuItem would be, um, challenging. As a first version you could go for "Imagine this causes menu items to be added".
3) Objects like SystemState (produced as ordinary JavaScript objects via widget.createObject-as-factory-method as mentioned above) could essentially return hard-coded dummy values. Some stubby support for events would also be required.
Sunday, August 23, 2009 8:57:07 PM (New Zealand Standard Time, UTC+12:00)
Nick Randolph pointed me towards this widget emulator:

He also suggested building with conditional statements, so that the widget can be deployed on other platforms too.

Monday, August 24, 2009 1:55:17 PM (New Zealand Standard Time, UTC+12:00)
I'll have to give that a try, it looks promising.
Comments are closed.