WinRT and WinPRT share the same core, so it makes a lot of sense to optimize your applications for maximum codeshare. I give an overview of the key similarities and differences of the platforms. I share best practices of some common application scenarios.
2. About the the presenter
• Karl Ots, Technical Consultant at Symbio
• Windows Phone 8 and Windows 8 trainer
• Windows Azure Insider
• Co-founder of Young Developers Finland
• Microsoft Student Partner
#td2013fi @fincooper
3. What we’ll cover
• What shared core means and what it doesn’t
• UX differences
• Porting vs maximum reuse
• Best practices of common scenarios
• Demos
#td2013fi @fincooper
10. WP8 app model
Native app model Legacy app model
#td2013fi @fincooper
11. Windows Phone Runtime
•Phone-specific additions to Windows Runtime include
• Speech synthesis and recognition
• Windows.Phone.PersonalInformation
• LockScreen and LockScreenManager
• More…
Full WinRT (around
11,000 members)
Subset adopted for New for Windows
Windows Phone Phone Runtime
Runtime (around (around 600
2,800 members) members)
#td2013fi @fincooper
13. Strategies for targeting both platforms
• Use Model-View-ViewModel
• Share portable .NET code in Portable Class Library
• Use common Windows Runtime API (Add as Link)
• Use Windows Runtime Components for language
interoperability
• Use #if conditionals for small code differences
• Use extension methods to bridge implementation
differences
#td2013fi @fincooper
21. HttpWebResponse and HttpWebRequest
var request = (HttpWebRequest)WebRequest.Create(autoCompleteUri);
HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
// retrieve data using StreamReader
#td2013fi @fincooper
22. HttpWebResponse and HttpWebRequest
var request = (HttpWebRequest)WebRequest.Create(autoCompleteUri);
request.BeginGetResponse(new AsyncCallback(AutoCompleteCallback), request);
}
private void AutoCompleteCallback(IAsyncResult callback)
{
HttpWebRequest request = (HttpWebRequest)callback.AsyncState;
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(callback);
// retrieve data using StreamReader
}
#td2013fi @fincooper
24. HttpWebResponse and HttpWebRequest
#if WINDOWS_PHONE
using MyExtensionClass
#endif
var request = (HttpWebRequest)WebRequest.Create(autoCompleteUri);
HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
// retrieve data using StreamReader
Use carefully – performance in ABYSMAL
#td2013fi @fincooper
32. Case: Moomin video store
• Windows 8 client ported to Windows Phone 8
• Core Models and ViewModels unchanged
• Azure backend for distributing media (Win8) and
keeping track of in-app purchases receipts
• Different Store, different in-app purchases
• WP: download limitations
• Different media players
#td2013fi @fincooper
33. Thank you!
Time for QA and a quick raffle!
#td2013fi @fincooper