Very soon devices with Windows 8 on board will go on sale. Happy owners will eagerly download and, for sure, buy apps. Those developers who will be the first in the store will naturally earn an order of magnitude more than others.
In this race, some developers have a significant advantage - the developers of applications for Windows Phone. Despite some panic around, porting WP7 applications was very easy.

')
In this article, we would like to share our porting experience using the example of our
Smeshariki app, which was made in conjunction with the licensed agency Marmelad Media and Microsoft.
In the article we will talk about porting pitfalls and give useful links for each item reviewed. If you do not have applications for Windows Phone - do not worry. You can consider the article as a set of links for developing Windows 8.
Story
Work with Smeshariki began when the licensed agency Marmelad Media asked for the redesign of our Erudite game, which we talked about in a
post two years ago.
When after some time we learned that Microsoft would be interested in sharing a joint product with Smeshariki within the framework of promoting the brand Windows Phone 7 on the Russian market, we decided to jointly create an application for selling cartoons, taking the technical side of the issue. Thus, Smeshariki appeared on the Windows Phone platform, and soon on Windows 8.
Smeshariki for Windows Phone
Smeshariki for Windows 8Our application is a cartoon store, with the possibility of their purchase and download to your device for future viewing. Simple enough in appearance, but with rather extensive functionality inside. When porting, we wanted to preserve both the recognizable look and the way the user works with the application.
As a result, we did it and what we had to face - below.
User interface
The greatest problems were caused by the porting of UI, since the devices and the general principles of working with them differ significantly. He has to practically write again. But not everything is so scary, and here's why.
Directly from the manufacturer about portingDesign guidelinesXaml
In general, this is the good old
xaml . Nothing has changed, to the extent that you can copy styles, brushes, templates and use them. There are new controls, for example GridView, and the main task is to arrange them correctly on the page. Here you can follow the guidelines, but this question is for designers, not for us, the developers.
Localization
Localization made just gorgeous. The
x: Uid attribute appeared in
xaml in order to localize individual properties of controls. A to localize images, you just need to properly design the structure of the directory where they lie.
The only problem we encountered is that it is not possible to easily localize application icons.
Enough detailed exampleviewstate and window dimensions
In Windows 8, all applications must support split-mode, this is not the case on the phone, and then naturally you need to write everything anew.
ViewState and
Blend comes to the
rescue . With them, everything becomes very simple and transparent. For some reason we didn’t immediately guess that split always and for all resolutions takes 320px.
Very detailed about everything connected with it.How to use blendCode
MVVM
One of the most important points. All the time that the porting took, our developer scolded himself that he did not strictly follow the principles of the pattern. In general, the more strictly you follow the pattern, the less code you will have to rewrite. Ideally, you only need to rewrite the XAML, the view and viewmodel remain unchanged.
Informative videoStorage (roaming) and personal folders
In Windows Phone, there is simple storage, in Windows 8, in addition, there is storage, which is replicated to all user devices and personal folders you can work with, you need to carefully distinguish between what is stored, since roaming storage has a limit on the amount of information inside.
We replicate only the settings, and downloaded cartoons and wallpapers are stored in personal folders.
Details about roamingAsync / await
A new language feature, there is a huge amount of articles about it and it could be used on Windows Phone. We did not use it, but we liked it so much that we copied the api layer. The code has decreased significantly.
Quickstart: Calling asynchronous APIs in C # or Visual BasicSpecial features
In Windows 8, there are many new features that are useful to use. But since the article is about porting, we will tell about those who were to some extent present on Windows Phone 7.
Live tiles
One of the main features of the phone, in Windows 8 it plays an even greater role. In the phone, we did not use it as actively as we could. In the ported version, we display new cartoons on the tile.
Here the approaches are somewhat different. If you want to deliver an update to a wide tile, you need to put a wide tile in the project in advance without an update.
In two parts creating tilesSharing contract
In the phone, it was possible to launch the standard sharing application through the networks that the user connected. In Windows 8, the approach is somewhat different. First, the sharing is located on the
charm bar , and the application must support it. Secondly, you can fumble only if you have an application that can do this, for example, Twitter.
Sharing exampleIn app purchase
There was no such possibility in the phone, we used Robokassa and the built-in browser. In Windows 8, this feature is there, it is quite simple to use. The problem is that you can add product IDs only with the application update. Since our application is updated less frequently than cartoons appear, we simply brought them in with a large margin.
To be fair, it should be noted that if only identifiers have changed in your update, the application will not be revised again, so the certification time is significantly shorter.
Details on in-app purchasesProblems
Media player
In the phone, we started viewing cartoons using the convenient
MediaPlayerLauncher . Unfortunately, there is no such possibility on Windows 8, but here the
Media Player Framework or
MediaPlayer control rescued us. We settled on
MPF .
Player frameworkBehaviours
The only problem that could not be solved. Blend for VS2012 comes without a library of
behaviors , it delivers certain inconveniences, to the extent that you have to write some classes yourself.
Finally
One can only guess about the success of Windows 8 now, but the fact remains: if you have already made an application for
Windows Phone , then you have a practically ready application for
Windows 8 .
I hope this small article will help you start porting and secure additional earnings in the new MarketPlace.
PS: thanks to our leading Windows Phone developer Timur garifzyanov for technical details.