![Page 1: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/1.jpg)
Architecting applications for WinRT and WinPRT
![Page 2: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/2.jpg)
#td2013fi @fincooper
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
![Page 3: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/3.jpg)
#td2013fi @fincooper
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
![Page 4: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/4.jpg)
Shared core
![Page 5: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/5.jpg)
#td2013fi @fincooper
Shared WinRT Core
Networking
Proximity
Sensors
Location
File System
Core app
model
Threading
![Page 6: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/6.jpg)
#td2013fi @fincooper
Windows 8 Platform
![Page 7: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/7.jpg)
#td2013fi @fincooper
• CLR – common language runtime
• BCL – base class library
• FCL – framework class library
Some definitions
![Page 8: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/8.jpg)
#td2013fi @fincooper
Windows 8 app model
![Page 9: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/9.jpg)
#td2013fi @fincooper
WP8 MANAGED app model
![Page 10: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/10.jpg)
#td2013fi @fincooper
WP8 app model
Native app model Legacy app model
![Page 11: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/11.jpg)
#td2013fi @fincooper
Windows Phone Runtime
Full WinRT (around
11,000 members)Subset adopted for
Windows Phone
Runtime (around
2,800 members)
New for Windows
Phone Runtime
(around 600
members)
•Phone-specific additions to Windows Runtime include
• Speech synthesis and recognition
•Windows.Phone.PersonalInformation
• LockScreen and LockScreenManager
•More…
![Page 12: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/12.jpg)
Targeting maximum reuse
![Page 13: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/13.jpg)
#td2013fi @fincooper
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
![Page 14: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/14.jpg)
#td2013fi @fincooper
Cross-platform app architecture with PLC
![Page 15: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/15.jpg)
Régis
LaurentDirector of Operations,
Global Knowledge
Competencies include:
Gold Learning
Silver System Management
DEMOPixPresenter
![Page 16: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/16.jpg)
#td2013fi @fincooper
What’s portable in PixPresenter?
Platform-specific
Portable /shareable
Platform-specific
Windows Phone app Windows Store app
![Page 17: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/17.jpg)
#td2013fi @fincooper
“Add as Link”
![Page 18: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/18.jpg)
Régis
LaurentDirector of Operations,
Global Knowledge
Competencies include:
Gold Learning
Silver System Management
DEMOAdd as Link
![Page 19: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/19.jpg)
#td2013fi @fincooper
Small code differences
Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>{
double _accelX = args.Reading.AccelerationX;double _accelY = args.Reading.AccelerationY;// Update ellipse location
});
Deployment.Current.Dispatcher.BeginInvoke(() =>{
double _accelX = args.Reading.AccelerationX;double _accelY = args.Reading.AccelerationY;//Update ellipse location
});
![Page 20: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/20.jpg)
#td2013fi @fincooper
Threading
#if NETFX_COREDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {#elseDeployment.Current.Dispatcher.BeginInvoke(() => {#endif
double _accelX = args.Reading.AccelerationX;double _accelY = args.Reading.AccelerationY;
#if conditional blocks
![Page 21: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/21.jpg)
#td2013fi @fincooper
HttpWebResponse and HttpWebRequest
var request = (HttpWebRequest)WebRequest.Create(autoCompleteUri);
HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
// retrieve data using StreamReader
![Page 22: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/22.jpg)
#td2013fi @fincooper
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
}
![Page 23: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/23.jpg)
#td2013fi @fincooper
Extension Methods
public static Task<HttpWebResponse> GetResponseAsync(this HttpWebRequest request){
var taskComplete = new TaskCompletionSource<HttpWebResponse>();request.BeginGetResponse(asyncResponse =>{
HttpWebRequest responseRequest = (HttpWebRequest)asyncResponse.AsyncState;
HttpWebResponse someResponse = (HttpWebResponse)responseRequest.EndGetResponse(asyncResponse);
taskComplete.TrySetResult(someResponse);}, request);
return taskComplete.Task;}
![Page 24: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/24.jpg)
#td2013fi @fincooper
HttpWebResponse and HttpWebRequest
#if WINDOWS_PHONEusing MyExtensionClass#endif
var request = (HttpWebRequest)WebRequest.Create(autoCompleteUri);
HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
// retrieve data using StreamReader
Use carefully – performance in ABYSMAL
![Page 25: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/25.jpg)
Best practices
![Page 26: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/26.jpg)
#td2013fi @fincooper
Most common reasons to fail certification
• Windows Phone: failure to check for (light) themes
• Windows 8: no privacy policy
![Page 27: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/27.jpg)
Do NOT share XAML. Just don’t.
![Page 28: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/28.jpg)
#td2013fi @fincooper
Different Form Factors Require Different UX
![Page 29: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/29.jpg)
#td2013fi @fincooper
Translating UX
![Page 30: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/30.jpg)
#td2013fi @fincooper
Translating UX – Details View
![Page 31: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/31.jpg)
CaseMoomin video store
![Page 32: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/32.jpg)
#td2013fi @fincooper
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
![Page 33: Architecting applications for Windows 8 and Windows Phone 8 by Karl Ots / @fincooper](https://reader033.vdocument.in/reader033/viewer/2022052619/5561747bd8b42a98268b499d/html5/thumbnails/33.jpg)
#td2013fi @fincooper
Thank you!Time for QA and a quick raffle!