Compartir a través de


Silverlight Time Zone World Clock (Very Beta) Demo

For my presentation of globalization of Silverlight at the Unicode Conference I wanted to make a quick Silverlight demo application that would show at least a little bit of globalization and not be too hard to write.  My first choice was to find an existing app, and thought I was close when I found a pretty application, but it was always stuck in English and didn't respect the user settings :(.

Then I thought about making a world clock in Silverlight.  I knew the Olsen tz database would provide the data, but I needed a map, so I did a live search for some maps.  Most seemed out of date, I didn't know if I could use them, and I'd have to map latitude/longitude to the image.  I sort of had a "duh" moment when I found VIEWS at https://www.codeplex.com/views.  VIEWS is a silverlight wrapper for the Virtual Earth control.  Virtual Earth (https://www.microsoft.com/virtualearth/) is really cool but, better yet, gives me latitude & longitude when you click.  Serious overkill for a world clock, but oh, well.

It took me about an hour to figure out how to make a silverlight app that used VIEWS.  Ironically this is the first time I've used the Visual Studio IDE to make a silverlight app.  Most of the silverlight code I write is low-level, so I use a console based test tool and don't make "real" silverlight apps normally.  After getting the flashy stuff done really quickly it took me a bit more effort to get the timezone database into a format I could read and use in the application.

My demo works for the most part, but has some serious bugs.  I didn't worry about getting the daylight savings transitions to behave, so the demo can be off by an hour for a few weeks around the transition times (I only enabled checking the month, not the day rules).  Also the tz database only has cities, not bounderies, so it can be hard to find the right data point.  I added Seattle by hand so that it wouldn't show Vancouver, BC when I did the demo, but many places can be a bit unexpected.  Clicking on Disney World in Florida (I just got back from vacation) will happily show you times for Havana, which probably isn't expected.  You have to go all the way "up" to New York to get Eastern Time.

I called the demo "SilverTime" and stuck it on CodePlex at https://www.codeplex.com/SilverTime. Its kind of cool, so I'm hoping that other people will participate in the open project and fix some of the bugs or extend its features.  There's some interesting potential in the app, and my bugs, although serious, aren't really that hard to fix.  (I was just running out of time before my vacation :-)

Have Fun,

Shawn

Comments