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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
httpwindowsMicrosoftcom
Test capabilities at runtimeUse Adaptive Code to light-up your app on specific devicesvar api = WindowsPhoneUIInputHardwareButtonsif (WindowsFoundationMetadataApiInformationIsTypePresent(api))
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
elif WINDOWS_UAP Processing for Windows UWP ndash Desktop AND Mobile if (WindowsFoundationMetadataApiInformation IsTypePresent(WindowsPhoneUIInputHardwareButtons)) But this is only for UWP AND Mobile
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
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
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)
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
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
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
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
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
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)
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
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
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
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
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
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)
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
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
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
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
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
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)
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
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
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
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
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
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)
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
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
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
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
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
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)
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
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
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
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
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
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)
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
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
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
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
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
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)
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
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
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
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
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
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)
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
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
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
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)
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
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
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
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)
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
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
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
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)
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
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
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
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)
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
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
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
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)
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
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
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
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
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)
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
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
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
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
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)
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
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
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
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
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)
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
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
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
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
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)
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
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
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
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
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)
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
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
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)
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
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
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)
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
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
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)
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
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
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)
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
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
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)
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
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
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)
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
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
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)
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
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
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)
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
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
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)
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
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
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)
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
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
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
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)
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
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
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
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)
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
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
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
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)
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
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
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
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)
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
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
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
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)
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
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
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
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)
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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