Date post: | 07-Nov-2014 |
Category: |
Documents |
Upload: | matthidinger |
View: | 1,027 times |
Download: | 3 times |
Matt Hidinger
Clarity Consulting
Sharing code withWindows 8 and Windows Phone 8
Clarity <3 Windows Phone
Agenda
Developer Choice
Sharing Strategies
Demos (code)
UX considerations
Your appsYour way
Windows Phone 8 Developer Platform
XAML Apps Direct3D Apps
XAML Maps Geolocation Sensors In-App Purchase Direct3D
HTML XML Threading Touch Speech XAudio2
Phone Features Push Camera Video Proximity Media
Foundation
Calendar Wallet Contacts Core Types VoIP STL
Multitasking Live Tiles Memory Async Enterprise CRT
C# and VB C#, VB, and C++ C++
File system, Networking, Graphics, Media
Core Operating System
shared coreFull WinRT
11,000 members
Windows Phone Runtime
2,800 shared members600 new members
Sharing techniques
Common Structure
Windows 8 Windows Phone 8
Model-View-ViewModel
Windows 8public class Product{ public int Id { get; set; }
[DataMember(Name = "text")] public string Text { get; set; }
[DataMember(Name = "complete")] public bool Complete { get; set; }}
public class Product{ public int Id { get; set; }
[DataMember(Name = "text")] public string Text { get; set; }
[DataMember(Name = "complete")] public bool Complete { get; set; }}
Windows Phone 8
Ctrl-CCtrl-V
“Add as Link”
04/08/2023Microsoft confidential11
“Add as Link”
Windows 8 Windows Phone 8
04/08/2023
Dispatcher Differences
Windows 8Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>{ MyTextBlock.Text = "Hello from the UI thread!";});
Deployment.Current.Dispatcher.BeginInvoke(() =>{ MyTextBlock.Text = "Hello from the UI thread!";});
Windows Phone 8
04/08/2023Microsoft confidential13
#if Conditional Blocks
Windows 8#if NETFX_COREDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {#endif
#if WINDOWS_PHONEDeployment.Current.Dispatcher.BeginInvoke(() => {#endif
Windows Phone 8
One Source
One Project
One Binary
Multiple Platforms!
Portable Class Libraries
Portable Class Library and MVVM
Your skills
You know C#You know .NETYou know and love XAML (right?)
Demo
UX Considerations
04/08/2023Microsoft confidential19
Web Service
04/08/2023Microsoft confidential20
UI Differences and XAML
Different Form Factors Require Different UX
Windows Phone 8 Windows 8
Screen Size
800x480
1280x720
1280x768
Screen Size
1024x768
2,560x1,440
everything in between
Different Form Factors Require Different UX
Windows Phone 8 Windows 8
Orientation
Portrait
Landscape
Orientation
Portrait
Landscape
Snapped
Different Controls
GridView
Group-able
Array of Tiles
Dynamic item size
Microsoft confidential24
Different Controls
Semantic Zoom
Pinch-zoom through grouped list of items
Microsoft confidential25
Different Form Factors Require Different UX
Panorama
Introduction and exploratory content
Microsoft confidential26
Different Form Factors Require Different UX
LongListSelector
Headers and Footers
Group header navigation
Microsoft confidential27
Translating UX
Semantic Zoom Pivot
Microsoft confidential28
Translating UX – Details View
Horizontal scroll Vertical scroll
Microsoft confidential29
Different Form Factors Require Different UXGridView LongListSelector
Way cross platform
http://bit.ly/NXVdHX
Summary
04/08/2023Microsoft confidential33
• Mix and match techniques
• Share Models, Helpers, Services, ViewModels• Linked files• Portable Class Libraries
• Using #if conditionals for small code differences
• Using Extension methods to bridge implementation differences• Async-await model for HttpWebResponse/Request
• Focus on the user experience that works for the form factor
Windows 8 / Windows Phone 8 Apps Are a Perfect Match
04/08/2023Microsoft confidential34
WP7 can do Async/Await!
Install-Package Microsoft.Bcl.Async
PCLs can add this package too!
Some WP7 Love
MVVM Frameworks
Caliburn.Micro
MVVM Light
Lessons Learned
Share code – architect with sharing in mind
Maximize the user experience in the UI
Use existing skills and knowledge