19
Lagash Systems Mariano Sánchez – Software Architect [email protected] @marianosz

Developing Universal Apps for Windows

Embed Size (px)

Citation preview

Page 1: Developing Universal Apps for Windows

Lagash SystemsMariano Sánchez – Software Architect

[email protected]@marianosz

Page 2: Developing Universal Apps for Windows

Universal Apps for Windows

Page 3: Developing Universal Apps for Windows

This module… Universal Apps Overview

Convergence summary Turning a project universal Code Sharing Strategies Universal + PCL

Page 4: Developing Universal Apps for Windows

Universal Apps Overview

Page 5: Developing Universal Apps for Windows

Universal Apps Applications on the converged Windows 8.1 and Windows Phone 8.1 platforms

Supported for C#, C++, and Javascript

Create universal apps using project templates or add Windows Phone 8.1 app to an existing Windows 8.1 app

Page 6: Developing Universal Apps for Windows

How Converged Is Windows?

Classes Structs Interfaces

Windows 8.1 SDK 566 119 59Windows Phone 8.1 SDK 624 131 57

+58 +12 -2

Page 7: Developing Universal Apps for Windows

Convert Project to UniversalExisting Windows 8.1 app can add Windows Phone 8.1 with shared project (and vice versa)

Page 8: Developing Universal Apps for Windows

#if Compiler ConditionalsUse #if to navigate differences between Windows and PhoneWindows = WINDOWS_APPWindows Phone = WINDOWS_PHONE_APPExample: Hardware back button is Windows Phone only

#if WINDOWS_PHONE_APPWindows.Phone.UI.Input.HardwareButtons.BackPressed +=

this.HardwareButtons_BackPressed;#endif

Page 9: Developing Universal Apps for Windows

Code Sharing Strategies

Page 10: Developing Universal Apps for Windows

Code Sharing OptionsShared Project Files

Most File TypesPortable Class Library

Libraries & Windows Runtime Components“Add As Link”

Page 11: Developing Universal Apps for Windows

Shared ProjectsAllow sharing source between converged appsNo binary outputSupports all items

Code filesXAMLImagesXML/JSONRESW

Page 12: Developing Universal Apps for Windows

Shared XAML ComponentsCross-Platform XAML

Visual State Manager to handle layout changes#if WINDOWS_APP var result = VisualStateManager.GoToState(this, "Windows", false);#elif WINDOWS_PHONE_APP var result = VisualStateManager.GoToState(this, "WindowsPhone", false);#endif

Page 13: Developing Universal Apps for Windows

Portable Class LibrariesFor Windows Universal Apps

Supports WinRT APIs

Output Windows Runtime Component Expose libraries to C++, Javascript apps

Page 14: Developing Universal Apps for Windows

Portable Class LibrariesFor Windows Universal Apps

Supports WinRT APIs

Output Windows Runtime Component Expose libraries to C++, Javascript apps

Broad Targeting for WP8, .NET

Page 15: Developing Universal Apps for Windows

“Add As Link”Similar to Shared file

Compiler conditionals to share across additional platforms

Page 16: Developing Universal Apps for Windows

Code Sharing Architecture Separation of Concerns

Decouple UI from logicUI In the Windows/Windows Phone projects

plus platform specific API sets (some geolocation, media, sensors)Logic in Shared project

plus XAML components that “make sense”

Page 17: Developing Universal Apps for Windows

Demo

Page 18: Developing Universal Apps for Windows

Preguntas?

Page 19: Developing Universal Apps for Windows

Muchas Gracias

Mariano Sánchez – Software [email protected]

@marianosz