sharing code win8 wp8

37
Matt Hidinger Clarity Consulting Sharing code with Windows 8 and Windows Phone 8

Upload: matthidinger

Post on 07-Nov-2014

1.039 views

Category:

Documents


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Sharing code win8 wp8

Matt Hidinger

Clarity Consulting

Sharing code withWindows 8 and Windows Phone 8

Page 2: Sharing code win8 wp8

Clarity <3 Windows Phone

Page 3: Sharing code win8 wp8

Agenda

Developer Choice

Sharing Strategies

Demos (code)

UX considerations

Page 4: Sharing code win8 wp8

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

Page 5: Sharing code win8 wp8

shared coreFull WinRT

11,000 members

Windows Phone Runtime

2,800 shared members600 new members

Page 6: Sharing code win8 wp8

Sharing techniques

Page 7: Sharing code win8 wp8

Common Structure

Windows 8 Windows Phone 8

Page 8: Sharing code win8 wp8

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

Page 9: Sharing code win8 wp8

Ctrl-CCtrl-V

Page 10: Sharing code win8 wp8

“Add as Link”

Page 11: Sharing code win8 wp8

04/08/2023Microsoft confidential11

“Add as Link”

Windows 8 Windows Phone 8

Page 12: Sharing code win8 wp8

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

Page 13: Sharing code win8 wp8

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

Page 14: Sharing code win8 wp8

One Source

One Project

One Binary

Multiple Platforms!

Portable Class Libraries

Page 15: Sharing code win8 wp8

Portable Class Library and MVVM

Page 16: Sharing code win8 wp8

Your skills

You know C#You know .NETYou know and love XAML (right?)

Page 17: Sharing code win8 wp8

Demo

Page 18: Sharing code win8 wp8

UX Considerations

Page 19: Sharing code win8 wp8

04/08/2023Microsoft confidential19

Web Service

Page 20: Sharing code win8 wp8

04/08/2023Microsoft confidential20

UI Differences and XAML

Page 21: Sharing code win8 wp8

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

Page 22: Sharing code win8 wp8

Different Form Factors Require Different UX

Windows Phone 8 Windows 8

Orientation

Portrait

Landscape

Orientation

Portrait

Landscape

Snapped

Page 23: Sharing code win8 wp8

Different Controls

GridView

Group-able

Array of Tiles

Dynamic item size

Page 24: Sharing code win8 wp8

Microsoft confidential24

Different Controls

Semantic Zoom

Pinch-zoom through grouped list of items

Page 25: Sharing code win8 wp8

Microsoft confidential25

Different Form Factors Require Different UX

Panorama

Introduction and exploratory content

Page 26: Sharing code win8 wp8

Microsoft confidential26

Different Form Factors Require Different UX

LongListSelector

Headers and Footers

Group header navigation

Page 27: Sharing code win8 wp8

Microsoft confidential27

Translating UX

Semantic Zoom Pivot

Page 28: Sharing code win8 wp8

Microsoft confidential28

Translating UX – Details View

Horizontal scroll Vertical scroll

Page 29: Sharing code win8 wp8

Microsoft confidential29

Different Form Factors Require Different UXGridView LongListSelector

Page 30: Sharing code win8 wp8

Way cross platform

Page 31: Sharing code win8 wp8

http://bit.ly/NXVdHX

Page 32: Sharing code win8 wp8

Summary

Page 33: Sharing code win8 wp8

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

Page 34: Sharing code win8 wp8

04/08/2023Microsoft confidential34

WP7 can do Async/Await!

Install-Package Microsoft.Bcl.Async

PCLs can add this package too!

Some WP7 Love

Page 35: Sharing code win8 wp8

MVVM Frameworks

Caliburn.Micro

MVVM Light

Page 36: Sharing code win8 wp8

Lessons Learned

Share code – architect with sharing in mind

Maximize the user experience in the UI

Use existing skills and knowledge

Page 37: Sharing code win8 wp8

Thank you!

@MattHidinger

[email protected]