I recently blogged about the EnergizeIT Insurance mobile app we built for Microsoft as part of the From the Client to the Cloud tour across Canada. (BTW there is still time to register for this as the last event is April 14 2010 in Toronto).
We did create this project before any announcement on Windows Phone 7 was made so it was created for Windows Phone 6.5. Since the announcement of the Windows Phone 7 developer tools I decided to port the existing .NET Compact Framework 3.5 code to Silverlight for Windows Phone 7. Considering I have only ‘played’ with Silverlight for the web and opened up some samples in Expression Blend, I figured it would be a good opportunity to learn the tools.
Porting the application was pretty straight forward. I was able to reuse some of the code but most of the code was not portable like pInvoke code and some custom controls primarily because it is not supported on Silverlight for Windows Phone 7. This is a good thing because there is less code to maintain and allows you to focus on your software and not the intricacies of the Windows Phone platform. This is a welcomed change!
In terms of re-using existing C# code, a lot of the business logic code was able to be re-used (since it was C#) which I believe to be more important. I was also able to leverage the existing WCF services in the Windows Phone 7 app without any modifications to the backend services or database.
From a BCL perspective, there are a few differences in the Silverlight for Windows Phone 7 APIs compared to .NET Compact Framework 3.5. Primarily there are different classes or namespaces to integrate with the phone such as the Application Bar instead of System.Windows.Forms.Menu and things like your mobile app running in a ‘sandbox’ and you have no access to things like the file system. But, making the transition from .NET Compact Framework to Silverlight for Windows Phone 7 was extremely easy. By far the easiest part was creating a ListBox, once I figured out how to DataBind and use DataTemplates, where the ListItems contained images and more than one line of text and each line having different fonts. This I have to say was a snap!
The most effort for myself was learning Expression Blend and figuring out how to do transitions and animations within Expression Blend. Once I figured out storyboards and timelines, making an animation was just too easy. I also took some time to learn how to create custom controls and modifying some existing Silverlight samples that are available on the web to work on Windows Phone 7. Since Windows Phone 7 also brings some new design principles called Metro, I also took the time to read and understand the Windows Phone UI Design and Interaction Guide and re-watched the Windows Phone UI and Design Language after seeing it at MIX10.
Overall, porting the app took about 7 days in total with most time going into porting 15 forms, creating 2 custom controls and experimenting with animations within Expression Blend. Porting the C# code was extremely straight forward as most of the previous code was re-used and nothing was touched on the backend services. In fact, both the Windows Phone 7 and 6.5 client use the exact same services. I would estimate about 50% of my time was used in creating the UI primarily in learning Expression Blend, creating custom controls, creating transitions and animations and porting forms. The rest was porting/re-using C# code and learning the new BCL and Windows Phone specific namespaces/classes.
Conclusion, developing good looking applications for Windows Phone 7 is a hell of a lot easier than building a good looking application for Windows Phone 6.x! Existing Silverlight and Windows Phone developers should not have any issues developing beautiful and compelling mobile applications for Windows Phone 7 using Silverlight.
The first time I saw Silverlight for Windows Phone (Windows Mobile back then) was in 2007 at MIX and MEDC Conferences from Scott Holden (who coincidently is now part of the XNA for Windows Phone 7 team). I even have a few posts on Silverlight for Mobile from 2008! For me it’s been three years for Silverlight to come to the phone and it’s a very welcomed change.
In the next few posts I’ll follow up with some more details on things like code sharing, custom controls that were created and some differences on going from .NET Compact Framework to Silverlight for Windows Phone 7 such as saving application state.
Here are some screens with a comparison of the Windows Phone 6.5 and 7 versions. Stay tuned!
On The Road Screen
Insurance Card Screen
New Claim Screen
Other Incident Info Screen