Developing Universal Apps for Windows

Preview:

Citation preview

Lagash SystemsMariano Sánchez – Software Architect

marianos@lagash.com@marianosz

Universal Apps for Windows

This module… Universal Apps Overview

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

Universal Apps Overview

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

How Converged Is Windows?

Classes Structs Interfaces

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

+58 +12 -2

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

#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

Code Sharing Strategies

Code Sharing OptionsShared Project Files

Most File TypesPortable Class Library

Libraries & Windows Runtime Components“Add As Link”

Shared ProjectsAllow sharing source between converged appsNo binary outputSupports all items

Code filesXAMLImagesXML/JSONRESW

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

Portable Class LibrariesFor Windows Universal Apps

Supports WinRT APIs

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

Portable Class LibrariesFor Windows Universal Apps

Supports WinRT APIs

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

Broad Targeting for WP8, .NET

“Add As Link”Similar to Shared file

Compiler conditionals to share across additional platforms

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”

Demo

Preguntas?

Muchas Gracias

Mariano Sánchez – Software Architectmarianos@lagash.com

@marianosz

Recommended