hello windows 10

168
Hello Windows 10 @gillcleeren @nicovermeir

Upload: gill-cleeren

Post on 13-Jan-2017

678 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Hello windows 10

Hello Windows 10gillcleerennicovermeir

httpwindowsMicrosoftcom

About GillGill CleerenMicrosoft Windows Platform MVP amp Regional DirectorOrdina architect ndash Practice ManagerPluralsight authorSpeakerBook author

gillcleerengillsnowballbewwwsnowballbe

httpwindowsMicrosoftcom

About NicoNico VermeirMicrosoft Windows Platform MVP

RealDolmen software engineer NET Mobile

Speaker

Book author

NicoVermeir

nico_vermeirhotmailcom

httpwwwspikiebe

httpwindowsMicrosoftcom

Agendabull The Story of 10 bull XAML then and now bull Data binding improvements bull Adaptive adaptive and more adaptive bull New in Live Tiles bull The App Lifecyclebull (Optional) App-to-App communication bull (Optional) App Services

Introducing the UWP

httpwindowsMicrosoftcom

Windows CoreThe refactored common coreOne hardware platformUniversal hardware driverStandard network and IO

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

DesktopSKU

PhoneSKU

XboxSKU

httpwindowsMicrosoftcom

One Windows

DesktopSKU

PC

2 in 1

MobileSKU

Tablet

Phablet

Phone

XboxSKU

Xbox

IoTSKU

Band

IoT headless

SKU

Raspberry Pi

Home Automati

on

Surface HubSKU

Surface Hub

HolographicSKU

HoloLens

Each family adds features to the one it inherits

httpwindowsMicrosoftcom

Easy for users to get amp stay

current

Unified core and app platform

The convergence journey

Windows Phone 75

Windows Phone 8Windows Phone 81

Windows 8

Xbox One

Windows on Devices

Xbox 360

Windows 81

Windows 10

ConvergedOS kernel

Convergedapp model

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 2: Hello windows 10

httpwindowsMicrosoftcom

About GillGill CleerenMicrosoft Windows Platform MVP amp Regional DirectorOrdina architect ndash Practice ManagerPluralsight authorSpeakerBook author

gillcleerengillsnowballbewwwsnowballbe

httpwindowsMicrosoftcom

About NicoNico VermeirMicrosoft Windows Platform MVP

RealDolmen software engineer NET Mobile

Speaker

Book author

NicoVermeir

nico_vermeirhotmailcom

httpwwwspikiebe

httpwindowsMicrosoftcom

Agendabull The Story of 10 bull XAML then and now bull Data binding improvements bull Adaptive adaptive and more adaptive bull New in Live Tiles bull The App Lifecyclebull (Optional) App-to-App communication bull (Optional) App Services

Introducing the UWP

httpwindowsMicrosoftcom

Windows CoreThe refactored common coreOne hardware platformUniversal hardware driverStandard network and IO

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

DesktopSKU

PhoneSKU

XboxSKU

httpwindowsMicrosoftcom

One Windows

DesktopSKU

PC

2 in 1

MobileSKU

Tablet

Phablet

Phone

XboxSKU

Xbox

IoTSKU

Band

IoT headless

SKU

Raspberry Pi

Home Automati

on

Surface HubSKU

Surface Hub

HolographicSKU

HoloLens

Each family adds features to the one it inherits

httpwindowsMicrosoftcom

Easy for users to get amp stay

current

Unified core and app platform

The convergence journey

Windows Phone 75

Windows Phone 8Windows Phone 81

Windows 8

Xbox One

Windows on Devices

Xbox 360

Windows 81

Windows 10

ConvergedOS kernel

Convergedapp model

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 3: Hello windows 10

httpwindowsMicrosoftcom

About NicoNico VermeirMicrosoft Windows Platform MVP

RealDolmen software engineer NET Mobile

Speaker

Book author

NicoVermeir

nico_vermeirhotmailcom

httpwwwspikiebe

httpwindowsMicrosoftcom

Agendabull The Story of 10 bull XAML then and now bull Data binding improvements bull Adaptive adaptive and more adaptive bull New in Live Tiles bull The App Lifecyclebull (Optional) App-to-App communication bull (Optional) App Services

Introducing the UWP

httpwindowsMicrosoftcom

Windows CoreThe refactored common coreOne hardware platformUniversal hardware driverStandard network and IO

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

DesktopSKU

PhoneSKU

XboxSKU

httpwindowsMicrosoftcom

One Windows

DesktopSKU

PC

2 in 1

MobileSKU

Tablet

Phablet

Phone

XboxSKU

Xbox

IoTSKU

Band

IoT headless

SKU

Raspberry Pi

Home Automati

on

Surface HubSKU

Surface Hub

HolographicSKU

HoloLens

Each family adds features to the one it inherits

httpwindowsMicrosoftcom

Easy for users to get amp stay

current

Unified core and app platform

The convergence journey

Windows Phone 75

Windows Phone 8Windows Phone 81

Windows 8

Xbox One

Windows on Devices

Xbox 360

Windows 81

Windows 10

ConvergedOS kernel

Convergedapp model

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 4: Hello windows 10

httpwindowsMicrosoftcom

Agendabull The Story of 10 bull XAML then and now bull Data binding improvements bull Adaptive adaptive and more adaptive bull New in Live Tiles bull The App Lifecyclebull (Optional) App-to-App communication bull (Optional) App Services

Introducing the UWP

httpwindowsMicrosoftcom

Windows CoreThe refactored common coreOne hardware platformUniversal hardware driverStandard network and IO

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

DesktopSKU

PhoneSKU

XboxSKU

httpwindowsMicrosoftcom

One Windows

DesktopSKU

PC

2 in 1

MobileSKU

Tablet

Phablet

Phone

XboxSKU

Xbox

IoTSKU

Band

IoT headless

SKU

Raspberry Pi

Home Automati

on

Surface HubSKU

Surface Hub

HolographicSKU

HoloLens

Each family adds features to the one it inherits

httpwindowsMicrosoftcom

Easy for users to get amp stay

current

Unified core and app platform

The convergence journey

Windows Phone 75

Windows Phone 8Windows Phone 81

Windows 8

Xbox One

Windows on Devices

Xbox 360

Windows 81

Windows 10

ConvergedOS kernel

Convergedapp model

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 5: Hello windows 10

Introducing the UWP

httpwindowsMicrosoftcom

Windows CoreThe refactored common coreOne hardware platformUniversal hardware driverStandard network and IO

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

DesktopSKU

PhoneSKU

XboxSKU

httpwindowsMicrosoftcom

One Windows

DesktopSKU

PC

2 in 1

MobileSKU

Tablet

Phablet

Phone

XboxSKU

Xbox

IoTSKU

Band

IoT headless

SKU

Raspberry Pi

Home Automati

on

Surface HubSKU

Surface Hub

HolographicSKU

HoloLens

Each family adds features to the one it inherits

httpwindowsMicrosoftcom

Easy for users to get amp stay

current

Unified core and app platform

The convergence journey

Windows Phone 75

Windows Phone 8Windows Phone 81

Windows 8

Xbox One

Windows on Devices

Xbox 360

Windows 81

Windows 10

ConvergedOS kernel

Convergedapp model

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 6: Hello windows 10

httpwindowsMicrosoftcom

Windows CoreThe refactored common coreOne hardware platformUniversal hardware driverStandard network and IO

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

DesktopSKU

PhoneSKU

XboxSKU

httpwindowsMicrosoftcom

One Windows

DesktopSKU

PC

2 in 1

MobileSKU

Tablet

Phablet

Phone

XboxSKU

Xbox

IoTSKU

Band

IoT headless

SKU

Raspberry Pi

Home Automati

on

Surface HubSKU

Surface Hub

HolographicSKU

HoloLens

Each family adds features to the one it inherits

httpwindowsMicrosoftcom

Easy for users to get amp stay

current

Unified core and app platform

The convergence journey

Windows Phone 75

Windows Phone 8Windows Phone 81

Windows 8

Xbox One

Windows on Devices

Xbox 360

Windows 81

Windows 10

ConvergedOS kernel

Convergedapp model

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 7: Hello windows 10

httpwindowsMicrosoftcom

One Windows

DesktopSKU

PC

2 in 1

MobileSKU

Tablet

Phablet

Phone

XboxSKU

Xbox

IoTSKU

Band

IoT headless

SKU

Raspberry Pi

Home Automati

on

Surface HubSKU

Surface Hub

HolographicSKU

HoloLens

Each family adds features to the one it inherits

httpwindowsMicrosoftcom

Easy for users to get amp stay

current

Unified core and app platform

The convergence journey

Windows Phone 75

Windows Phone 8Windows Phone 81

Windows 8

Xbox One

Windows on Devices

Xbox 360

Windows 81

Windows 10

ConvergedOS kernel

Convergedapp model

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 8: Hello windows 10

Each family adds features to the one it inherits

httpwindowsMicrosoftcom

Easy for users to get amp stay

current

Unified core and app platform

The convergence journey

Windows Phone 75

Windows Phone 8Windows Phone 81

Windows 8

Xbox One

Windows on Devices

Xbox 360

Windows 81

Windows 10

ConvergedOS kernel

Convergedapp model

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 9: Hello windows 10

httpwindowsMicrosoftcom

Easy for users to get amp stay

current

Unified core and app platform

The convergence journey

Windows Phone 75

Windows Phone 8Windows Phone 81

Windows 8

Xbox One

Windows on Devices

Xbox 360

Windows 81

Windows 10

ConvergedOS kernel

Convergedapp model

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 10: Hello windows 10

httpwindowsMicrosoftcom

Phone Small Tablet

2-in-1s(Tablet or Laptop)

Desktops amp All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub

Holographic

Windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 11: Hello windows 10

httpwindowsMicrosoftcom

Multiple device families

PC XBoxMobile Surface Hub

HoloLensDevices +IoT

Universal Windows Apps

One Store +One Dev Center

Reuse Existing CodeOne SDK +

Tooling

Adaptive User Interface Natural

User Inputs

One Universal Windows Platform

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 12: Hello windows 10

httpwindowsMicrosoftcom

Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 13: Hello windows 10

httpwindowsMicrosoftcom

Windows appA single binary Running on any deviceTesting for capabilitiesAdjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 14: Hello windows 10

httpwindowsMicrosoftcom

The developer storyWhen writing for iOS A developer writes for iPad amp iPhone

When writing for Android A developer writes for all supported devices

When writing for Windows 8 A developer writes for each devices

When writing for Windows 10 A developer writes for every device

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 15: Hello windows 10

DEMOHello World

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 16: Hello windows 10

httpwindowsMicrosoftcom

Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktop

extension

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 17: Hello windows 10

Extensions dont invalidate binaries on other devices

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 18: Hello windows 10

httpwindowsMicrosoftcom

UAP

Windows Core Windows Core Windows Core Windows Core

UAP UAP UAP

Desktop Mobile Xbox Morehellip

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 19: Hello windows 10

httpwindowsMicrosoftcom

Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))

WindowsPhoneUIInputHardwareButtonsCameraPressed += CameraButtonPressed

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 20: Hello windows 10

httpwindowsMicrosoftcom

Windows 10operating system

Bridging technologies

Win32

desktop

Webhosted

JavaAndroid

ObjCiOS

Universal Windows Platform

WWAC++amp CX

Netlanguages

HTMLDirectXXAML

C++

Netlanguages

MFCWFWPF

Netruntime

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 21: Hello windows 10

XAML then and now

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 22: Hello windows 10

httpwindowsMicrosoftcom

Windows 810 Layout controlsltBorder Thickness= Brush= gt

ltCanvas gt

ltGrid gt

ltRelativePanel gt

ltScrollViewer gt

ltSplitView DisplayMode= gt

ltStackPanel Orientation= gt

ltVariableSizedWrapGrid gt

ltViewBox Stretch= gt

New in Win10

New in Win10

>

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 23: Hello windows 10

httpwindowsMicrosoftcom

RelativePanelDefines an area within which you can position and align child objects in relation to each other or the parent panel

RelativePanel is a constraint based layout container that you can use to create UIs by expressing spatial relationships between elements

Using RelativePanelrsquos attached properties you can position a UI element relative to another UI element (A is RelativePanelBelow B) as well as relative to the panel (A is RelativePanelAlignTopWithPanel)

-MSDN

New in Win10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 24: Hello windows 10

httpwindowsMicrosoftcom

RelativePanelSome child elementsact as anchorsMost child elementsrelate to othersIts a layout techniquefriendly with States

See Adaptive Triggers later

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 25: Hello windows 10

httpwindowsMicrosoftcom

Important propertiesAttached propertiesbull Above amp Below bull AlignBottomWith amp AlignTopWith bull AlignBottomWithPanel amp AlignTopWithPanel bull AlignHorizontalCenterWith amp AlignVerticalCenterWith bull AlignHorizontalCenterWithPanel amp AlignVerticalCenterWithPanel bull AlignLeftWith amp AlignRightWith bull AlignLeftWithPanel amp AlignRightWithPanel bull LeftOf amp RightOf

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 26: Hello windows 10

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder Width=100 Height=100 Background=Blue RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=TruegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 27: Hello windows 10

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAbove=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 28: Hello windows 10

httpwindowsMicrosoftcom

Some RelativePanel samples

ltRelativePanelgt ltBorder xName=ElementOne Width=200 Height=200 Background=Red RelativePanelAlignHorizontalCenterWithPanel=True RelativePanelAlignVerticalCenterWithPanel=Truegt ltBorder xName=ElementTwo Width=100 Height=100 Background=Blue RelativePanelAlignBottomWith=ElementOnegtltRelativePanelgt

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 29: Hello windows 10

httpwindowsMicrosoftcom

Some RelativePanel samplesltRelativePanel BorderBrush=Gray BorderThickness=10gt ltRectangle xName=RedRect Fill=Red MinHeight=100 MinWidth=100gt ltRectangle xName=BlueRect Fill=Blue MinHeight=100 MinWidth=100 RelativePanelRightOf=RedRect gt ltRectangle xName=GreenRect Fill=Green MinHeight=100 Margin=0500ldquo RelativePanelBelow=RedRect RelativePanelAlignLeftWith=RedRect RelativePanelAlignRightWith=BlueRectgt ltRectangle Fill=Yellow MinHeight=100 RelativePanelBelow=GreenRect RelativePanelAlignLeftWith=BlueRect RelativePanelAlignRightWithPanel=Truegt ltRelativePanelgt

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 30: Hello windows 10

DEMORelativePanel

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 31: Hello windows 10

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 32: Hello windows 10

httpwindowsMicrosoftcom

We wanted this for a long time

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 33: Hello windows 10

httpwindowsMicrosoftcom

Now available the SplitViewltSplitView xName=SplitView Background=Black OpenPaneLength=240 CompactPaneLength=48 DisplayMode=CompactOverlay IsPaneOpen=False Content=Bindinggt ltSplitViewPanegt ltStackPanel xName=SplitViewPanePanelgt ltRadioButton xName=BackRadioButton Click=BackRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Back GroupName=Backgt ltRadioButton xName=HamburgerRadioButton Click=HamburgerRadioButton_Click

Style=StaticResource NavRadioButtonStyle Content=Menu GroupName=Hamburgergt ltStackPanelgt ltSplitViewPanegtltSplitViewgt

New in Win10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 34: Hello windows 10

httpwindowsMicrosoftcom

SplitView IsPaneOpen=True IsPaneOpen=False

DisplayMode=Inline

DisplayMode=Overlay

DisplayMode=CompactInline

DisplayMode=CompactOverlay

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 35: Hello windows 10

httpwindowsMicrosoftcom

Sample SplitView ltSplitView xName=MySplitView DisplayMode=CompactOverlay IsPaneOpen=False CompactPaneLength=50 OpenPaneLength=150gt ltSplitViewPanegt ltStackPanel Background=Graygt ltButton xName=HamburgerButton FontFamily=Segoe MDL2 Assets Content=ampxE700 Width=50 Height=50 Background=Transparent Click=HamburgerButton_Clickgt ltStackPanel Orientation=Horizontalgt ltButton xName=MenuButton1 FontFamily=Segoe MDL2 Assets Content=ampxE825 Width=50 Height=50 Background=Transparentgt ltTextBlock Text=Button 1 FontSize=18 VerticalAlignment=Center gt ltStackPanelgt hellip ltStackPanelgt ltSplitViewPanegt ltSplitViewContentgt ltGridgt ltTextBlock Text=SplitView Basic FontSize=54 Foreground=Whitegt ltGridgt ltSplitViewContentgtltSplitViewgt

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 36: Hello windows 10

httpwindowsMicrosoftcom

The resulting SplitView

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 37: Hello windows 10

DEMOSplitView

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 38: Hello windows 10

httpwindowsMicrosoftcom

ButtonsltButton Content= gt

ltHyperlinkButton gt

ltRepeatButton gt

ltToggleButton IsChecked= gt

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 39: Hello windows 10

httpwindowsMicrosoftcom

Text controlsltTextBox Text= gt

ltPasswordBox Text= gt

ltTextBlock Text= gt

ltAutoSuggestBox gt

ltRichEditBox Content= gt

ltRichTextBlock Content= gt

ltBitmapIcon UriSource= gt

ltFontIcon Glyph= gt

ltSymbolIcon Icon= gt

ltPathIcon Data= gt

New in Win10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 40: Hello windows 10

httpwindowsMicrosoftcom

AutoSuggestBox New in Win10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 41: Hello windows 10

DEMOText controls

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 42: Hello windows 10

httpwindowsMicrosoftcom

Selection and picker controlsltCalendarView gt

ltDatePicker Date= gt

ltTimePicker Time= gt

ltToggleSwitch IsChecked= gt

ltCheckBox IsCHecked= gt

ltRadioButton IsChecked= gt

ltComboBox gt

ltListBox gt

ltSlider Minimum= Maximum= gt

Win10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 43: Hello windows 10

httpwindowsMicrosoftcom

CalendarViewWindows uses this one itself

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 44: Hello windows 10

DEMOSelection amp pickers

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 45: Hello windows 10

httpwindowsMicrosoftcom

Collectiondata controlsltItemsControl ItemsSource= gt

ltFlipView gt

ltGridView gt

ltListView gt

ltSematicZoom gt

ltPivot gt

ltHub Orientation= gt

ltContentControl ControlTemplate= gt

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 46: Hello windows 10

httpwindowsMicrosoftcom

Pivot

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 47: Hello windows 10

httpwindowsMicrosoftcom

App bars and commandsltAppBar gt

ltCommandBar gt

ltAppBarButton Label= Icon= gt

ltAppBarToggleButton IsChecked= gt

ltAppBarSeparator gt

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 48: Hello windows 10

httpwindowsMicrosoftcom

Flyout controlsltPopup IsOpen= gt

ltContentDialog Title= Content= gt

ltFlyout Placement= gt

ltMenuFlyout gt

ltToolTip gt

New in Win10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 49: Hello windows 10

httpwindowsMicrosoftcom

ContentDialog

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 50: Hello windows 10

DEMO

Flyout controls amp ContentDialog

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 51: Hello windows 10

httpwindowsMicrosoftcom

Progress Media amp Inking controlsltProgressBar IsIntermediate= gt

ltProgressRing IsActive= gt

ltImage gt

ltInkCanvas gt

ltMediaElement gt

New in Win10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 52: Hello windows 10

httpwindowsMicrosoftcom

InkCanvasExtremely complex control to start using

ltGridgt lt-- Itrsquos this simple --gt ltInkCanvasgtltGridgt

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 53: Hello windows 10

DEMOInking

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 54: Hello windows 10

httpwindowsMicrosoftcom

Maps

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 55: Hello windows 10

DEMOMap control

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 56: Hello windows 10

httpwindowsMicrosoftcom

Live Visual Tree New in Win10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 57: Hello windows 10

DEMOLive Visual Tree

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 58: Hello windows 10

Data binding

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 59: Hello windows 10

What problem are we solving

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 60: Hello windows 10

httpwindowsMicrosoftcom

Classic Bindin

g

Compiled

Binding

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 61: Hello windows 10

httpwindowsMicrosoftcom

xBindCompiled bindingBindings are committed at compile-time

Strongly-typed bindingDuck binding is not supported

Default mode is OneTimeOneWay and TwoWay are still available

Standard binding approachesINotifyPropertyChanged IObservableVector INotifyCollectionChanged

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 62: Hello windows 10

The data context of xBind is the code-behind class

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 63: Hello windows 10

httpwindowsMicrosoftcom

SyntaxltTextBox Text=Binding

ConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

ltTextBox Text=xBindConverterConverterLanguageConverterParameterElementNameFallbackValueModePathRelativeSourceSourceTargetNullValueUpdateSourceTrigger

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 64: Hello windows 10

DEMO

Using the Compiled binding

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 65: Hello windows 10

httpwindowsMicrosoftcom

ltListView ItemsSource=xBind ViewModelEmployeesgt

ltListViewItemTemplategt

ltDataTemplate xDataType=modelEmployeegt

ltGridgt

ltTextBlock Text=xBind Namegt

ltGridgt

ltDataTemplategt

ltListViewItemTemplategt

ltListViewgt

Data Templates

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 66: Hello windows 10

httpwindowsMicrosoftcom

Syntax differences ltListView ItemsSource=Binding Items Header=Classic GridColumn=0gt ltListViewItemTemplategt ltDataTemplategt ltTextBlock Text=Binding Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

ltListView ItemsSource=xBind ViewModelItems xmlnsm=usingBlank3Models Header=Compiled GridColumn=1gt ltListViewItemTemplategt ltDataTemplate xDataType=mTodoItemgt ltTextBlock Text=xBind Title gt ltDataTemplategt ltListViewItemTemplategtltListViewgt

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 67: Hello windows 10

httpwindowsMicrosoftcom

Resource dictionariesltResourceDictionary

xClass=MyNamespaceMyTemplates

xmlnsmodel=usingxBindSampleModelgt

ltDataTemplate

xKey=MyTemplate

xDataType=modelEmployeegt

ltTextBlock Text=xBind Name gt

ltDataTemplategt

ltResourceDictionarygt

namespace MyNamespace public class MyTemplates public MyTemplates() InitializeComponent()

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 68: Hello windows 10

httpwindowsMicrosoftcom

Referencing a dictionaryltUserControlResourcesgt

ltResourceDictionarygt

ltResourceDictionaryMergedDictionariesgt

ltlocalMyTemplatesgt

ltResourceDictionary Source=filename gt

ltResourceDictionaryMergedDictionariesgt

ltResourceDictionarygt

ltUserControlResourcesgt

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 69: Hello windows 10

httpwindowsMicrosoftcom

Binding for EventsltButton Click=PokeEmployeegtPoke EmployeeltButtongt

ltButton Click=xBind EmployeePokegtPoke EmployeeltButtongt

SignatureHave no parameters - void Poke()Match event parameters - void Poke(object sender RoutedEventArgs e)Match event base types - void Poke(object sender object e)Overloading is not supported

Because all events are eligibleThis may replace ICommand amp EventToCommandNote this does not include parameter or CanExecute

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 70: Hello windows 10

httpwindowsMicrosoftcom

PageViewModelpublic sealed partial class MainPage Page public MainPage() InitializeComponent() thisDataContextChanged += (s e) =gt ViewModel = DataContext as ViewModelsMainPageViewModel

strongly-typed view models enable xbind public ViewModelsMainPageViewModel ViewModel get set

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 71: Hello windows 10

DEMO

Using a ViewModel declaratively

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 72: Hello windows 10

httpwindowsMicrosoftcom

When to use classic bindingDuck TypingText=ldquoBinding Agerdquo works for both PersonModel amp WineModel

Dictionary graphsUse Binding with JSON or other untyped objects

Code-behind binding adding and removing bindings on the flyCan addremove xBind runtime

Use in a stylexBind canrsquot be used in a style for settersxBind can be used in a DataTemplate that is defined in the style

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 73: Hello windows 10

xBind is not for every situation right nowIt will in the future

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 74: Hello windows 10

xBind can meet your binding needs most of the time Letrsquos say around 80

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 75: Hello windows 10

The adaptive story

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 76: Hello windows 10

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 77: Hello windows 10

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 78: Hello windows 10

httpwindowsMicrosoftcom

>

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 79: Hello windows 10

httpwindowsMicrosoftcom

Tailored designBuild pagescode for individual familiesUse MRT in Appxamlcs to determine the family

One-handed interfaceTypically phone or small tabletsTest diagonal screen size (lt7)

if (physical_diagonal_size lt= 7) optimized for one-handed operation rootFrameNavigate(typeof(MainPage_OneHanded) eArguments)else rootFrameNavigate(typeof(MainPage) eArguments)

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 80: Hello windows 10

Nothing is stopping you from creating a multi-headed solution

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 81: Hello windows 10

httpwindowsMicrosoftcom

Dedicated targeted apps

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 82: Hello windows 10

Adaptive tooling

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 83: Hello windows 10

httpwindowsMicrosoftcom

Visual StatesDefine XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 84: Hello windows 10

DEMO

Visual states Adaptive triggers Custom triggers

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 85: Hello windows 10

How Windowsmakes design easier

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 86: Hello windows 10

httpwindowsMicrosoftcom

Adaptive controls

>
>

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 87: Hello windows 10

httpwindowsMicrosoftcom

Input intelligence

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 88: Hello windows 10

Techniques to adapt

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 89: Hello windows 10

httpwindowsMicrosoftcom

Three core adaptive approachesResponsive designResize your contentReflow your content

Adaptive designReposition your contentRedesign your content

Tailored design

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 90: Hello windows 10

httpwindowsMicrosoftcom

Resize

>

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 91: Hello windows 10

httpwindowsMicrosoftcom

Reflow

>

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 92: Hello windows 10

httpwindowsMicrosoftcom

Reposition

>

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 93: Hello windows 10

httpwindowsMicrosoftcom

Redesign

>

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 94: Hello windows 10

Dont assume you will use only one technique

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 95: Hello windows 10

Adaptive Code and API versions

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 96: Hello windows 10

httpwindowsMicrosoftcom

Using Specific Versions of an APIAdaptive code techniques are not only for handling device family-specific codeYou write your app against a base UWP version but 6 months later UWP vNext ships to users machinesApplies to Extension SDKs and Packages as well ndash new versions may offer new functionality

You want to keep supporting customers who havenrsquot updated yet but take advantage of up-level APIs for those who have

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 97: Hello windows 10

httpwindowsMicrosoftcom

Package DependencyltDependenciesgt ltPackageDependency Name=MicrosoftWinJS 10 Publisher=CN=Microsoft Corporation O=Microsoft Corporation L=Redmond S=Washington C=US

minVersion =1500 gtltDependenciesgt

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 98: Hello windows 10

httpwindowsMicrosoftcom

Gate use of up-level APIsvar contract = DevicesScannersScannerDeviceContractint majorVersionRequired = 3

if (WindowsFoundationMetadataApiInformation IsApiContractPresent(contract majorVersionRequired ))

Call the API that is present in V3 and above else Your original code supporting users who havenrsquot upgraded yet

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 99: Hello windows 10

What about Shared Projects

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 100: Hello windows 10

httpwindowsMicrosoftcom

What about shared projectsShared Projects share code at the code level pre-compilationShare with Windows 81 projects Xamarin projects anythinghellip

Still completely supportedif Compilation directives used to conditionally include code by those projects referencing the Shared Project

1 WINDOWS_APP2 WINDOWS_PHONE_APP3 WINDOWS_UAP (new)

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 101: Hello windows 10

httpwindowsMicrosoftcom

Use Adaptive Code in Shared tooif WINDOWS_PHONE_APP Processing for Windows Phone 81 only

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile

WindowsPhoneUIInputHardwareButtonsCameraPressed += thisCamera_Pressed

endif

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 102: Hello windows 10

Tile basics

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 103: Hello windows 10

httpwindowsMicrosoftcom

Basic State

Plate

App LogoShort Name

Plate

App Logo

Short Name

Semi-Live State

Plate

App LogoShort NameBadge

Plate

App Logo

Short Name

Badge

Live State

Plate

App IconShort Name

Badge

Content

Plate

Short Name

BadgeApp Icon

Content

Tile anatomy

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 104: Hello windows 10

httpwindowsMicrosoftcom

Updating tilesScheduledSet template and time with ldquoScheduledTileNotificationrdquo

PeriodicPull from URL 30m 60m 6h 12h 24h

LocalUpdate from (foregroundbackground) app

PushUse push servicesUpdate badge

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 105: Hello windows 10

httpwindowsMicrosoftcom

Update tile badge build badgevar type = BadgeTemplateTypeBadgeNumbervar xml = BadgeUpdateManagerGetTemplateContent(type)

update elementvar elements = xmlGetElementsByTagName(badge)var element = elements[0] as WindowsDataXmlDomXmlElementelementSetAttribute(value 47)

send to lock screenvar updator = BadgeUpdateManagerCreateBadgeUpdaterForApplication()var notification = new BadgeNotification(xml)updatorUpdate(notification)

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 106: Hello windows 10

httpwindowsMicrosoftcom

Responsive tilesTiles are not always the same sizeTiles adapt tothe screen they are onSince the Start grid has different densities and adapts to the screen size of your device so do our tiles and the content within them

High density exampleLow density example

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 107: Hello windows 10

Tile templates

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 108: Hello windows 10

httpwindowsMicrosoftcom

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 109: Hello windows 10

httpwindowsMicrosoftcom

Legacy templatesIf a template meets your needs go ahead and use it Previous templates remainPhone and Windows templates have been mergedThere are over 80 templates available

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 110: Hello windows 10

httpwindowsMicrosoftcom

Create a secondary tilevar tileId = DetailsTilevar pinned = SecondaryTileExists(tileId)

if (pinned) var tile = new SecondaryTile(tileId) DisplayName = Record details Arguments = 123

extra details var success = await tileRequestCreateAsync()

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 111: Hello windows 10

Use secondary tiles to deep-link into your app

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 112: Hello windows 10

Adaptive templates

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 113: Hello windows 10

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgt ltbinding template=TileMediumgt ltgroupgt ltsubgroupgt lttext hint-style=subtitlegtJohn Doelttextgt lttext hint-style=subtlegtPhotos from our triplttextgt lttext hint-style=subtlegtThought you mighthelliplttextgt ltsubgroupgt ltgroupgt ltgroupgt ltsubgroupgt hellip ltsubgroupgt ltgroupgt ltbindinggt ltvisualgtlttilegt Min Med Size Max Med Size

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 114: Hello windows 10

httpwindowsMicrosoftcom

Adaptive tileslttilegt ltvisualgtltbinding template=TileMediumgt ltimage source=Assetsimagepng placement=background gt

lttext hint-wrap=truegtMicrosoft HoloLens A Sensational Vision of the PCrsquos Future

lttextgtltbindinggt ltvisualgtlttilegt

Min Med Size Max Med Size

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 115: Hello windows 10

Adaptive samples

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 116: Hello windows 10

httpwindowsMicrosoftcom

Sample Small Tile

ltbinding template=TileSmall

branding=none hint-textStacking=centergt

ltbindinggt

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 117: Hello windows 10

httpwindowsMicrosoftcom

Sample 1 Medium Tileltbinding template=TileMedium branding=Name displayName=Hipstamegt

lttext hint-style=captiongt 950 AM Wednesdaylttextgt

lttext hint-style=captionsubtle hint-wrap=truegt 263 Grove St San Francisco CA 94102lttextgt

ltbindinggt

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 118: Hello windows 10

httpwindowsMicrosoftcom

Sample Wide Tileltbinding template=TileWide displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgtltbindinggt

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 119: Hello windows 10

httpwindowsMicrosoftcom

Sample Large Tileltbinding template=TileLarge displayName=Hipstamegt ltgroupgt ltsubgroup hint-weight=33gt ltimage placement=inline src=httpimagejpg gt ltsubgroupgt ltsubgroupgt lttext hint-style=captiongt 950 AM Wednesdaylttextgt lttext hint-style=captionsubtle hint-wrap=true hint-maxLines=3gt 263 Grove St San Francisco CA 94102lttextgt ltsubgroupgt ltgroupgt ltimage placement=inline src=httpmapjpggtltbindinggt

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 120: Hello windows 10

httpwindowsMicrosoftcom

AdaptiveTemplates

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 121: Hello windows 10

Application lifecycle

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 122: Hello windows 10

httpwindowsMicrosoftcom

App Lifecycle wersquove had already with Windows 81

Runningapp

Suspendedapp

Suspending Terminatedapp

Low memory

Resuming

Background task executes

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 123: Hello windows 10

The resultPredictable behavior on every Windows device

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 124: Hello windows 10

httpwindowsMicrosoftcom

Application LifetimeRunning Suspended Running Suspended Not Running

Launched Suspended(5 seconds)

Activated Suspended(5 seconds)

Mem

ory

Terminated(no event)

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 125: Hello windows 10

Important note Desktop device-family apps suspend when they are minimized

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 126: Hello windows 10

httpwindowsMicrosoftcom

Handling suspensionpublic App() thisInitializeComponent()

thisSuspending += (s e) =gt Save data

thisResuming += (s e) =gt Load data

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 127: Hello windows 10

httpwindowsMicrosoftcom

Navigation stateFrameGetNavigationState()FrameSetNavigationState()Recommended to use strings as parameters

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 128: Hello windows 10

httpwindowsMicrosoftcom

OnNavigatedFrompublic override Task OnNavigatedFromAsync(IDictionaryltstring objectgt state bool suspending) if (suspending) state[FirstName] = thisFirstName state[LastName] = thisLastName state[Email] = thisEmail return TaskFromResultltobjectgt(null)

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 129: Hello windows 10

httpwindowsMicrosoftcom

OnNavigatedTopublic override void OnNavigatedTo(string parameter NavigationMode mode IDictionaryltstring objectgt state) try thisFirstName = state[FirstName]ToString() thisLastName = state[LastName]ToString() thisEmail = state[Email]ToString() finally stateClear()

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 130: Hello windows 10

DEMOHandle suspend

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 131: Hello windows 10

Extended executionWin10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 132: Hello windows 10

httpwindowsMicrosoftcom

Extended executionRequesting extended executionThere is no guarantee resources are availableExtended execution has no UI

Scenario ldquoI have data this timerdquoHandle the Revoked event (1 second warning)

Scenario ldquoIrsquom a special kind of apprdquoThese apps run indefinitely

Special kinds of apps1Turn-by-turn (location tracking) app2Audio amp VOIP application

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 133: Hello windows 10

There is a balance between load speed amp shutdown time

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 134: Hello windows 10

httpwindowsMicrosoftcom

Extended execution (type 1)M

emor

y

Running Extend

Suspended(5 seconds)

Request Revoked(1 second)

Suspended

No UI(short)

Suspended(No event)

Whensuspendin

g

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 135: Hello windows 10

httpwindowsMicrosoftcom

Requesting extension in suspendprivate async void OnSuspending(object sender SuspendingEventArgs args)

var deferral = argsSuspendingOperationGetDeferral() using (var session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonSavingData ) sessionDescription = Upload Data sessionRevoked += (s e) =gt Log(Save incomplete)

try if (await sessionRequestExtensionAsync() == ExtendedExecutionResultDenied) takes 3 seconds UploadBasicData() else takes 8 seconds await UploadDataAsync(session) Log(Save complete) catch Log(Save failed) finally deferralComplete()

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 136: Hello windows 10

Extend the suspension of a foreground app

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 137: Hello windows 10

httpwindowsMicrosoftcom

Extended execution (type 2)M

emor

y

Running Extend

Navigateaway

Special Request(during runtime)

Revoked(1 second)

Suspended

No UI(long running)

Suspended(No event)

Automaticextension

Whenrunning

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 138: Hello windows 10

Prevent the terminationof a foreground app

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 139: Hello windows 10

httpwindowsMicrosoftcom

Requesting extension in appprivate async void InvokeMyExtension() if (this_session == null) this_session = new ExtendedExecutionSession Reason = ExtendedExecutionReasonLocationTracking this_sessionDescription = ldquoDriving directions

if (await this_ sessionRequestExtensionAsync() == ExtendedExecutionResultAllowed) todo approved else todo denied

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 140: Hello windows 10

httpwindowsMicrosoftcom

Enum VALUES[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionReason Unspecified = 0 LocationTracking = 1 SavingData = 2

[ContractVersion(typeof(UniversalApiContract) 65536)]public enum ExtendedExecutionResult Allowed = 0 Denied = 1

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 141: Hello windows 10

The global pool supports burst events

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 142: Hello windows 10

DEMOExtended execution

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 143: Hello windows 10

App to App in Windows 81

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 144: Hello windows 10

httpwindowsMicrosoftcom

LauncherLaunchUriAsync(new Uri(sampleappID=aea6))

LauncherLaunchFileAsync(file)

App to App in Windows 81URIProtocol Activation

Data in UriFile

UserOS chooses target

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 145: Hello windows 10

httpwindowsMicrosoftcom

App to App in Windows 81Share Contract

DataTransferManagerShowShareUI()

Share DataPackage

User chooses target

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 146: Hello windows 10

App to App in Windows 10 UWP

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 147: Hello windows 10

httpwindowsMicrosoftcom

Enhanced App to App in Windows 10

Send file token send data

Launch a specific app

App Services

Launch for Results

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 148: Hello windows 10

httpwindowsMicrosoftcom

URI Activation++Invoke a specific app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options)

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 149: Hello windows 10

httpwindowsMicrosoftcom

URI Activation++Send Files

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919InstapaperIt

var token = SharedStorageAccessManagerAddFile (gpxFile)

ValueSet inputData = new ValueSet()inputDataAdd(Token token)

var launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriAsync(launchUri options inputData)

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 150: Hello windows 10

httpwindowsMicrosoftcom

Query URI SupportDiscover if app already installed to handle a Uri

var queryUri = new Uri(instapaper)await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUri)

var queryUri = new Uri(instapaper)string packageFamilyName = 24919InstapaperIt await LauncherQueryUriSupportAsync(queryUri LaunchUriTypeLaunchUriForResults packageFamilyName)

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 151: Hello windows 10

httpwindowsMicrosoftcom

App Services

Client App A

Client App B Background Task

App with App Service

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 152: Hello windows 10

httpwindowsMicrosoftcom

URI Activation for Device SettingsCategory Settings page Mobile andor

Desktop Uri

System

Display (on desktop)Screen (on mobile) Both ms-settingsscreenrotation

Notifications Both ms-settingsnotifications

Storage Sense Both ms-settingsstoragesense

Battery Saver Both ms-settingsbatterysaver

Maps Both ms-settingsmaps

Devices Bluetooth Both ms-settingsbluetooth

Network and Wi-fi

Wi-Fi Both ms-settingsnetworkwifi

Airplane mode Both ms-settingsnetworkairplanemode

Cellular Both ms-settingsnetworkcellular

Data Sense Both ms-settingsdatasense

NFC Mobile only ms-settingsproximity

Proxy Desktop only ms-settingsnetworkproxy

Morehellip [See documentation for complete list]

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 153: Hello windows 10

DEMO

URI Activation in UWP

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 154: Hello windows 10

httpwindowsMicrosoftcom

Launch for ResultsLaunching the app

var options = new LauncherOptions()optionsTargetApplicationPackageFamilyName = 24919Instapvar launchUri = new Uri(instapaperAddUrl=http3A2F2Fbingcom)await LauncherLaunchUriForResultsAsync(launchUri options data)

var resultData = new ValueSet()resultDataAdd(Result value)operationProtocolForResultsOperationReportCompleted(resultData)

App1 App2

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 155: Hello windows 10

DEMOLaunch for Results

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 156: Hello windows 10

With App Services store applications can provide services to other store applications

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 157: Hello windows 10

httpwindowsMicrosoftcom

What are App ServicesUWP offers many APIs that allow apps to interact with the platformbull WindowsApplicationModelContactsbull WindowsApplicationModelEmailbull WindowsSystemLauncherLaunchUriAsync to launch settings maps

store etchellipbull morehellip

UWP also allows apps to interact with each otherbull Uri Associations using LaunchUriAsyncbull File associations using LaunchFileAsyncbull Launch for results using LaunchUriForResultsAsyncbull App Services

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 158: Hello windows 10

httpwindowsMicrosoftcom

Think lsquoWeb Services on devicersquoClient App A

Client App B

Background Task

App with App Service

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 159: Hello windows 10

httpwindowsMicrosoftcom

Scenario Bar Code Scanning

Bar Code decoding App

ServiceImage bytes in ValueSet or FileToken

Decoded data

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 160: Hello windows 10

httpwindowsMicrosoftcom

Scenario Enterprise suite of apps

App ServiceMaintains Inventory

cache

Client App A

Client App B

Interact with cloud services

App ServiceProximity Reading

Services

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 161: Hello windows 10

httpwindowsMicrosoftcom

AppServiceConnection connection = new AppServiceConnection()connectionAppServiceName = microsoftDX-appservicesdemoconnectionPackageFamilyName = 24919ArunjeetSinghInstapaperIt

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) Send data to the service var message = new ValueSet() messageAdd(Command CalcSum) messageAdd(Value1 Int32Parse(Value1Text)) messageAdd(Value2 Int32Parse(Value2Text))

Send message and wait for response AppServiceResponse response = await connectionSendMessageAsync(message) if (responseStatus == AppServiceResponseStatusSuccess) int sum = (int)responseMessage[Result] new MessageDialog(Result= + sum)ShowAsync() else Drive the user to store to install the app that provides the app service

App Services ndash Client

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 162: Hello windows 10

httpwindowsMicrosoftcom

namespace AppServicesDemoTask public sealed class AppServiceTask IBackgroundTask private static BackgroundTaskDeferral _serviceDeferral

public void Run(IBackgroundTaskInstance taskInstance) Associate a cancellation handler with the background task taskInstanceCanceled += TaskInstance_Canceled

Get the deferral object from the task instance _serviceDeferral = taskInstanceGetDeferral()

var appService = taskInstanceTriggerDetails as AppServiceTriggerDetails if (appServiceName == microsoftDX-appservicesdemo) Maybe ValidateCaller(appServiceCallerPackageFamilyName) appServiceAppServiceConnectionRequestReceived += RequestReceived

App Services ndash Service (12)

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 163: Hello windows 10

httpwindowsMicrosoftcom

private async void RequestReceived(AppServiceConnection sender AppServiceRequestReceivedEventArgs args) var message = argsRequestMessage This service uses a Command keyed entry for the client to invoke services from the App Service string command = message[Command] as string switch (command) case DoIt var messageDeferral = argsGetDeferral() int value1 = (int)message[Value1] Do some processing

Set a result to return to the caller var returnMessage = new ValueSet() returnMessageAdd(Result result) var responseStatus = await argsRequestSendResponseAsync(returnMessage) messageDeferralComplete() break case Quit Service was asked to quit Complete service deferral so platform can terminate _serviceDeferralComplete() break

App Services ndash Service (22)

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 164: Hello windows 10

httpwindowsMicrosoftcom

Declaring App Serviceltxml version=10 encoding=utf-8gtltPackage xmlns=httpschemasmicrosoftcomappxmanifestfoundationwindows10 gt

ltApplicationsgt ltApplication Id=Appldquo gt ltExtensionsgt ltuapExtension Category=windowsappServiceldquo EntryPoint=AppServicesDemoTaskAppServiceTaskgt ltuapAppService Name=microsoftDX-appservicesdemo gt ltuapExtensiongt ltExtensionsgt ltApplicationgt ltApplicationsgt

ltCapabilitiesgt ltCapability Name=internetClient gt ltCapabilitiesgtltPackagegt

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 165: Hello windows 10

httpwindowsMicrosoftcom

Two-way CommunicationClient and server can keep a two-way chatty communication channel openClient can attach a RequestReceived event handler to its own AppServiceConnection instance

Both client and server can send and receive messages

AppServiceConnectionStatus connectionStatus = await connectionOpenAsync()if (connectionStatus == AppServiceConnectionStatusSuccess) connectionRequestReceived += OnRequestReceived

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 166: Hello windows 10

DEMOApp Services

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 167: Hello windows 10

httpwindowsMicrosoftcom

SummaryWindows 10 allows for REAL universal appsKnowledge of WinRT is still very relevant

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10
Page 168: Hello windows 10

Letrsquos enjoy Windows 10hellipand some BBQ

  • Hello Windows 10
  • About Gill
  • About Nico
  • Slide 4
  • Introducing the UWP
  • Windows Core
  • Slide 7
  • Each family adds features to the one it inherits
  • The convergence journey
  • Slide 10
  • Slide 11
  • Universal Windows Platform
  • Windows app
  • The developer story
  • Hello World
  • Platform extensions
  • Extensions dont invalidate binaries on other devices
  • Slide 18
  • Test capabilities at runtime
  • Slide 20
  • XAML then and now
  • Windows 810 Layout controls
  • RelativePanel
  • RelativePanel (2)
  • Important properties
  • Some RelativePanel samples
  • Some RelativePanel samples (2)
  • Some RelativePanel samples (3)
  • Some RelativePanel samples (4)
  • RelativePanel (3)
  • We wanted this for a long time
  • We wanted this for a long time (2)
  • Now available the SplitView
  • SplitView
  • Sample SplitView
  • The resulting SplitView
  • SplitView (2)
  • Buttons
  • Text controls
  • AutoSuggestBox
  • Text controls (2)
  • Selection and picker controls
  • CalendarView
  • Selection amp pickers
  • Collectiondata controls
  • Pivot
  • App bars and commands
  • Flyout controls
  • ContentDialog
  • Flyout controls amp ContentDialog
  • Progress Media amp Inking controls
  • InkCanvas
  • Inking
  • Maps
  • Map control
  • Live Visual Tree
  • Live Visual Tree
  • Data binding
  • What problem are we solving
  • Slide 62
  • xBind
  • The data context of xBind is the code-behind class
  • Syntax
  • Using the Compiled binding
  • Data Templates
  • Syntax differences
  • Resource dictionaries
  • Referencing a dictionary
  • Binding for Events
  • PageViewModel
  • Using a ViewModel declaratively
  • When to use classic binding
  • xBind is not for every situation right now It will in the
  • xBind can meet your binding needs most of the time Letrsquos say
  • The adaptive story
  • Slide 78
  • Slide 79
  • Slide 80
  • Tailored design
  • Nothing is stopping you from creating a multi-headed solution
  • Dedicated targeted apps
  • Adaptive tooling
  • Visual States
  • Visual states Adaptive triggers Custom triggers
  • How Windows makes design easier
  • Adaptive controls
  • Input intelligence
  • Techniques to adapt
  • Three core adaptive approaches
  • Resize
  • Reflow
  • Reposition
  • Redesign
  • Dont assume you will use only one technique
  • Adaptive Code and API versions
  • Using Specific Versions of an API
  • Package Dependency
  • Gate use of up-level APIs
  • What about Shared Projects
  • What about shared projects
  • Use Adaptive Code in Shared too
  • Tile basics
  • Tile anatomy
  • Updating tiles
  • Update tile badge
  • Responsive tiles
  • Tile templates
  • Slide 110
  • Legacy templates
  • Create a secondary tile
  • Use secondary tiles to deep-link into your app
  • Adaptive templates
  • Adaptive tiles
  • Adaptive tiles (2)
  • Adaptive samples
  • Sample Small Tile
  • Sample 1 Medium Tile
  • Sample Wide Tile
  • Sample Large Tile
  • Slide 122
  • Application lifecycle
  • App Lifecycle wersquove had already with Windows 81
  • The result Predictable behavior on every Windows device
  • Application Lifetime
  • Important note Desktop device-family apps suspend when they
  • Handling suspension
  • Navigation state
  • OnNavigatedFrom
  • OnNavigatedTo
  • Handle suspend
  • Extended execution
  • Extended execution
  • There is a balance between load speed amp shutdown time
  • Extended execution (type 1)
  • Requesting extension in suspend
  • Extend the suspension of a foreground app
  • Extended execution (type 2)
  • Prevent the termination of a foreground app
  • Requesting extension in app
  • Enum VALUES
  • The global pool supports burst events
  • Extended execution (2)
  • App to App in Windows 81
  • App to App in Windows 81 (2)
  • App to App in Windows 81 (3)
  • App to App in Windows 10 UWP
  • Enhanced App to App in Windows 10
  • URI Activation++
  • URI Activation++ (2)
  • Query URI Support
  • App Services
  • URI Activation for Device Settings
  • URI Activation in UWP
  • Launch for Results
  • Launch for Results (2)
  • With App Services store applications can provide services to o
  • What are App Services
  • Think lsquoWeb Services on devicersquo
  • Scenario Bar Code Scanning
  • Scenario Enterprise suite of apps
  • App Services ndash Client
  • App Services ndash Service (12)
  • App Services ndash Service (22)
  • Declaring App Service
  • Two-way Communication
  • App Services
  • Summary
  • Letrsquos enjoy Windows 10