Last week we highlighted Den Delimarsky's Visual Studio Achievements for Windows Phone 7 app. On this Metro Monday, seems fitting to pair that post up with this one.
With Windows 8 and Metro a common question is, "How hard is it to re-use, re-purpose or port a Windows Phone 7 app to a Windows 8 Metro Style app?"
Den's stepped up and answered that very question...
I ported this application to Windows 8 as a general learning experience and made the notes available for the public. You can familiarize yourself with the process I followed by reading the articles below:
- Porting Visual Studio Achievements for WP to Windows 8 - Layout and basic bindings
- Porting Visual Studio Achievements for WP to Windows 8 - Minor problems and data acquisition
- Porting Visual Studio Achievements for WP to Windows 8 - Getting primary user input
- Porting Visual Studio Achievements for WP to Windows 8 - Serialization and Storage
- Porting Visual Studio Achievements for WP to Windows 8 - Viewing and Sharing
- Porting a Windows Phone application to Windows 8 - A Look from 10,000 Feet Above
If you would like to share some feedback and similar experiences, feel free to do so.
The series starts at the very beginning,starting with a Windows Phone 7 app and then through completing it and documenting lessons learned.
One of the great features that is currently highlighted for Windows 8 and specifically WinRT is the low barrier of entry for existing Windows Phone and Silverlight developers in general. There was already a case of an existing Windows Phone application being ported to the new OS, but I decided to actually document the entire porting process in its core.
Let's start with the very basics and assume that I have no code whatsoever on my local machine. I am heading over to the CodePlex page and download the source ZIP. OI course, you might want to choose a version control system and pull the source that way, but I will leave that at your own discretion. The default solution is of course opened in Visual Studio 2010. Your solution contents should resemble this:
Now let's working on the actual new project. Launch Visual Studio 11 Beta and click on New Project. Select Visual C# > Windows Metro Style and finally - Blank Application. Give a unique name to the project. I personally used VSAW8. Open BlankPage.xaml - this is the main work page that will display all necessary user information. For convenience purposes, I renamed it to MainPage.xaml.
I managed to successfully port my Visual Studio Achievements for Windows Phone to Windows 8 - it now fully works in the Metro environment with absolutely the same capabilities as its mobile counterpart (the Windows 8 version is mobile to some extent too, since Windows 8 will be used on tablets). This article represents a general overview of the process.
As long as the application is well-designed, it should not take much time to port it to Metro. So if you have a good separation of concerns and files are structured well in a solution, you can just copy and paste the necessary components, adjust the namespaces, update references and you are ready to go in a lot of cases. There are exceptions, that I will be talking about later in this article, but generally the most time-consuming part of the process is the threading model reorganization.
Recommended reading: App Porting to Windows 8 Already Possible
There is not much trouble with modifying references either. As I was moving code files from the Windows Phone project to the Metro one, I had to do slight modifications in the JSON parser that is now accessed through Windows.Data.Json, which is much nicer than its Silverlight counterpart, by the way, and I was not sure how I should reference it.
The overall porting experience is straightforward and easy to the point where parts of it could be automated. Should a developer create applications that are released both for Windows 8 and Windows Phone? Yes. Can most of the code base be reused? Yes. Do both applications have to provide the same experience? The consistency of the UI is a given as long as you are following the general conventions, but you might also consider building a Windows Phone application that is a companion for its Windows 8 counterpart instead of a duplicate.
If you have a Windows Phone 7 app today and are wondering what it would take turn it into a Windows 8 Metro Style app, or are just interested in seeing a Windows 8 Metro Style app being built, this series is a must read...