One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI ...

27
One app to rule them all Zero to hero with the Universal Windows Platform development Daniel Vistisen Senior consultant Bluefragments Deani Hansen Developer & UI designer blendrocks

Transcript of One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI ...

Page 1: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

One app to rule them allZero to hero with the Universal Windows Platform development

Daniel VistisenSenior consultant

Bluefragments Deani HansenDeveloper & UI designer

blendrocks

Page 2: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Daniel

Senior developer at

Bluefragments.

Architect & developer

Deani

Windows app engineer

at Slack.

UI designer and

developer

Page 3: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

One hour from now..

Fundamentals of the Universal Windows Platform

Responsive UI

<RelativePanel /> <VisualStates /> <Triggers />

Continuum and different target devices

Q/A

Page 4: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Demo app

IoTPhoneDesktop

4K video 720p video Image

Page 5: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Phone Small Tablet2-in-1s

(Tablet or Laptop)

Desktops & All-in-OnesPhablet Large Tablet

Classic Laptop

Xbox IoTSurface Hub Holographic

Windows 10

Page 6: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target
Page 7: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Windows device families

Page 8: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Universal App != Universal App

Windows 8.1 Windows 10

Full Screen

Portable Class Libraries (PCL)

Windows Runtime (WinRT)

One binary per target

Intermediate Language

Resizable Windows

XAML + PCL

Core API + WinRT

One Binary Overall

.NET Native

Page 9: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target
Page 10: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Relative

resolutions

Page 11: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Relative Panel

A new XAML layout control, which arranges its children by declaring relationships between

them.

<RelativePanel> … </RelativePanel>

Page 12: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.relativepanel

RelativePanel, on MSDN

https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.relativepanel

Page 13: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Layout and <RelativePanel />

DEMO

4K video

Page 14: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target
Page 15: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Visual states based on WindowSize – Pre UWP

public MainPage(){

this.InitializeComponent();this.SizeChanged += (s, e) =>{

var state = “Default";if (e.NewSize.Width > 500)

state = “Narrow";else if (e.NewSize.Width > 750)

state = “Normal";else if (e.NewSize.Width > 1000)

state = “Full";VisualStateManager.GoToState(this, state, true);

};}

Page 16: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Visual states with adaptive triggers (UWP)

<VisualState x:Name="VisualState500min"><VisualState.StateTriggers>

<AdaptiveTrigger MinWindowWidth=“720" /></VisualState.StateTriggers>

</VisualState>

MinWindowHeight (Minimum height for state)

MinWindowWidth (Minimum width for state)

Page 17: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Responsive UI with<VisualState />

DEMO

4K video

720p video

Page 18: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Windows 10 on Raspberry Pi 2 Model B

Low cost (less than 300 DKK)

HDMI Video Out1 GB memory & A7

900 Mhz (ARM) running Windows10

Runs Windows 10 !

Low hardware specs

Limited resources

Can only run one app at a time

Don’t do this at home

HD video

Lots of pictures

Huge lists without item virtualization

Page 19: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Device family specific code

bool isHardwareButtonsAPIPresent = Windows.Foundation.Metadata.ApiInformation

.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons");

Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += TestView_BackRequested;

var qualifiers = ResourceContext.GetForCurrentView().QualifierValues;string currentDeviceFamily;qualifiers.TryGetValue("DeviceFamily", out currentDeviceFamily); // currentDeviceFamily == ”IoT”

Page 20: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Device family specific VisualState trigger

By building a simple custom trigger we can get rid of the code behind check.

More UI logic contained in XAML

Page 21: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Custom trigger &Raspberry Pi

DEMO

4K video720p videoImage

Page 22: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Projection API & Continuum

Page 23: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Very powerful for product companies - high enterprise value – you’re already there with adaptive UI

Continuum

Page 24: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Projection Manager API

Page 25: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

private async void StartProjecting_Click(object sender, RoutedEventArgs e){

//Check whether there is already active connection to an external displayif (ProjectionManager.DisPlayAvailable){

int thisViewId;thisViewId = ApplicationView.GetForCurrentView().Id;

var thisDispatcher = Window.Current.Dispatcher;await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal,()=>{

// Display the page in the view. Not visible until “StartProjectionAsync” calledvar rootFrame = new Frame();rootFrame.Navigate(typeof(ProjectionViewPage), initData);Window.Current.Content = rootFrame;Window.Current.Activate();

});

// Show the view on a second displayawait ProjectionManager.StartProjectingAsync(rootPage.Id, thisViewId);

}}

private async void StopProjecting_Click(object sender, RoutedEventArgs e){

await ProjectionManager.StopProjectingAsync(rootPage.ProjectionViewPageControl.Id, thisViewId);}

Projection Manager API

Page 26: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Wrapping up

UWP platform – one binary to rule them all feat. device families

Responsive UI is king

Bonus: One unified store for all apps with all device families

Really really high reusability

Page 27: One app to rule them all · Fundamentals of the Universal Windows Platform Responsive UI    Continuum and different target

Daniel Vistisen

@danielvistisen

Deani Hansen

@deanihansen