windows store apps - lessons learned

50
Windows Store apps lessons learned @andyhammar - [email protected] @chribben - [email protected]

Upload: chribben

Post on 24-May-2015

619 views

Category:

Documents


0 download

DESCRIPTION

Presentation about building Windows Store apps in C#/XAML. By Andreas Hammar and Christian Jacobsen

TRANSCRIPT

Page 1: Windows Store apps - Lessons Learned

Windows Store apps

lessons learned

@andyhammar - [email protected]

@chribben - [email protected]

Page 2: Windows Store apps - Lessons Learned

Windows StoreView states

Store

What we’ve done

Navigation

Blend

Touch

Page 3: Windows Store apps - Lessons Learned

What we’ve done

Page 4: Windows Store apps - Lessons Learned

Blend

Page 5: Windows Store apps - Lessons Learned

Design time data

View model Design time view model AppBar binding

Page 6: Windows Store apps - Lessons Learned

View model

Page 7: Windows Store apps - Lessons Learned

Design time view model

Page 8: Windows Store apps - Lessons Learned

AppBar binding

Page 9: Windows Store apps - Lessons Learned

View states

Page 10: Windows Store apps - Lessons Learned

Your app must support a snapped layout.

In landscape orientation, your app’s

functions must be fully accessible when the

app’s display size is 1024 x 768. Your app

must remain functional when the customer

snaps and unsnaps the app.

Page 11: Windows Store apps - Lessons Learned

…maintain state, context, and interactivity

Page 12: Windows Store apps - Lessons Learned

What?

Full screen

Filled

Snapped

Page 13: Windows Store apps - Lessons Learned

How?

Design time – define visual states

or

Page 14: Windows Store apps - Lessons Learned

How?

Run time – apply correct visual state

Window.Current.SizeChanged += SizeChanged;...private void SizeChanged(object sndr, WindowSizeChangedEventArgs e){ var viewState = ApplicationView.Value; VisualStateManager.GoToState(this, viewState.ToString(), false);}

Page 15: Windows Store apps - Lessons Learned

Tips

//When snapped visual state is static, use a page if (ApplicationView.Value == ApplicationViewState.Snapped) Frame.Navigate(typeof (MySnappyPage));

Page 16: Windows Store apps - Lessons Learned

Tips

var snappedLeft = ApplicationView.Value ==

ApplicationViewState.Snapped && Window.Current.Bounds.Left == 0;

Page 17: Windows Store apps - Lessons Learned

Gotcha

Page 18: Windows Store apps - Lessons Learned

Tips

Page 19: Windows Store apps - Lessons Learned

Navigation

Page 20: Windows Store apps - Lessons Learned

App anatomy

Application

Window

Frame

Page

Page 21: Windows Store apps - Lessons Learned

Fundamental navigation

//Plain navigationFrame.Navigate(typeof (MySuperDuperPage));

//Parameter passingFrame.Navigate(typeof (DisplayItemPage), itemId);

Page 22: Windows Store apps - Lessons Learned

Fundamental navigation

protected override void OnNavigatedTo(NavigationEventArgs e){ int itemId = (int) e.Parameter; _myViewModel.SelectedItemId = itemId;

.

.

.}

Page 23: Windows Store apps - Lessons Learned

Fundamental navigation

Frame.CanGoBackFrame.GoBack()Frame.CanGoForwardFrame.GoForward()

Frame.Navigated Frame.NavigatingFrame.NavigationFailedFrame.NavigationStopped

Page 24: Windows Store apps - Lessons Learned

Helpers

Page 25: Windows Store apps - Lessons Learned

State

SessionState

FrameState

FrameState

NavigationState

PageStatePageStatePageState

NavigationState

PageStatePageStatePageState

App

Page 26: Windows Store apps - Lessons Learned

TipsUse a background frame for stuff that must survive page switching

Background Frame

Frame

Page

Background Page

Page 27: Windows Store apps - Lessons Learned

Tips

Use caching for improved navigation performance

Page 28: Windows Store apps - Lessons Learned

Gotcha

Parameter passing – you can pass any object….

BUT

The platform only support serializing of basic types

Page 29: Windows Store apps - Lessons Learned

Summary

Rootframe Navigate with simple parameters Use caching if app with many pages

Page 30: Windows Store apps - Lessons Learned

Touch

Page 31: Windows Store apps - Lessons Learned

Pointer events

PointerPressed, PointerReleased, PointerMoved

PointerCanceled, PointerCaptureLost, PointerEntered, PointerExited, PointerWheelChanged

Page 32: Windows Store apps - Lessons Learned

Pointer events

• e.GetCurrentPoint() .PointerId .Properties.IsMiddleButtonPressed

• e.GetIntermediatePoints

Page 33: Windows Store apps - Lessons Learned

Static gestures

• Derived from Pointer-events

Tapped DoubleTapped Holding RightTapped

• One concurrent event per UI Element

Page 34: Windows Store apps - Lessons Learned

Manipulation gesture events

ManipulationStarted, ManipulationCompleted

ManipulationDelta, ManipulationInertiaStarting, ManipulationStarting

Page 35: Windows Store apps - Lessons Learned

Manipulation gesture events

• Inertia• Often used to set RenderTransform• Derived from Pointer-events • One concurrent event per UI Element

Page 36: Windows Store apps - Lessons Learned

Brainstormer

Page 37: Windows Store apps - Lessons Learned

Screen table - "Surface"/FlatFrog

no up or down difficult with global UI elements

Use popups or duplicates

Page 38: Windows Store apps - Lessons Learned

Concurrent popup

One concurrent event per UI Element, e.g. Canvas

double-click better than tap-n-hold ugly trick: Put a grid with many elements inside

the canvas (Routed events)

Page 39: Windows Store apps - Lessons Learned

Manipulation transforms

CompositeTransform e.Cumulative.Rotation No concurrent Repeatbuttons e.handled = true

Page 40: Windows Store apps - Lessons Learned

Windows Store

Page 41: Windows Store apps - Lessons Learned

Windows Store

Publish WACK Privacy policy Live account Publisher name Background audio

Manage Change app name Remove app

Page 42: Windows Store apps - Lessons Learned

WACK

Is step 1 of certification process always run this.

Page 43: Windows Store apps - Lessons Learned

Privacy policy

Blog post by Dag König: http://bit.ly/RWGouo

Must have in metadata and accessible in app.

Page 44: Windows Store apps - Lessons Learned

Live account

Use separate live-ID for win8 apps.

Page 45: Windows Store apps - Lessons Learned

Publisher name

For company accounts, ”must” match registration papers.

Page 46: Windows Store apps - Lessons Learned

Background audio

Background audio prevents suspend, do not autoplay!

Page 47: Windows Store apps - Lessons Learned

Change app name

App name can be changed.

Page 48: Windows Store apps - Lessons Learned

Remove app

Apps cannot be removed, only updated to no markets.

Page 49: Windows Store apps - Lessons Learned

Get started – Store

• Create Microsoft account• Create Store account• Reserve app name

Page 50: Windows Store apps - Lessons Learned

Thank you for coming!

the end