At the end of May, Applied Information Sciences began work on a Silverlight-enabled version of the Conservation...
Those developers, Pete Brown and Steve Suing, had a tight timetable -- Conservation International wanted the Carbon Calculator live by July 7, 7/7/07, the day that Live Earth concerts on six continents raised awareness about global warming.
Though the going was tough at times -- animation support was rough around the edges, controls had to be written from scratch and error handling was reminiscent of VB 5 -- the tough got going, and the Carbon Calculator was finished on time.
"It is a production application built on an alpha product. As far as I know, it is the first Silverlight 1.1 application to go into production," Brown, lead architect and project manager at Applied Information Sciences, said during a session at the recent ReMIX07 Boston. Of Silverlight 1.1 alpha, he said, "There was an awful lot in there that was already working."
The Carbon Calculator lets site visitors determine their carbon footprint, which is the amount of carbon dioxide they are personally responsible for emitting into the Earth's atmosphere. Once a user is finished with the survey, the application calculates how much he or she would have to contribute to offset those emissions and redirects to a donation form.
Integration of SharePoint 2007, Virtual Earth and JSON Web services went smoothly, thanks largely to XAML, LINQ and other features of Visual Studio 2008. Brown said. So, too, did the designer-developer workflow work well -- partly because it was a two-man team, admittedly, but also because Brown and Suing established that which could not change early on and made sure that code did not change.
However, as one would expect with alpha version software, obstacles did arise.
First, since Silverlight 1.1 lacks controls, and third-party controls are still few and far between, "We spent the majority of our time writing from scratch drop-down ListBoxes and other controls that you usually get for free," Brown said.
This partly explains why the application uses a redirect to the Carbon Calculator's donation form. "Rolling our own TextBox control was way beyond the scope of what we were doing for this project," Brown admitted. In addition, Conservation International wanted to maintain the ability to update the form from time to time, which would have involved re-coding the control. Finally, pop-up blockers are not familiar with Silverlight, so taking query string parameters and loading them into a new browser window was far more desirable than allowing pop-ups and watching a page refresh erase all the data a user has entered into the application.
The underlying structure of the application presented another challenge. Again, Applied Information Sciences had to build the controls from scratch, and Brown wanted a survey that would be easy to build and simultaneously intuitive and recognizable to end users.
The solution came from tried and true Visual Basic 6 implementations -- UserControl screens built as "a series of wizard-like controls." Each screen is its own XAML file and sits atop the main page.xaml document. UI elements, in turn, sit atop the UserControl screens.
This model worked well because Silverlight applications, like Ajax applications, present state issues that traditional, Web 1.0 applications cannot confront, Brown said. As he put it to the audience, "When you are building these applications, keep in mind that you are dealing more with a WinForms app than with an ASP.NET app."
The downside, of course, is that model makes the survey look like a lot like a Windows application with rectangular boxes. Given that Silverlight 1.1's animation support improved dramatically from the May release to the September release, Brown said that, were he to do it over again, he would have included more animation.