59
Windows Store apps lessons learned @andyhammar - [email protected] @roberthedgate - [email protected] [email protected]

Win8 development lessons learned jayway

Embed Size (px)

DESCRIPTION

Seminar with a bunch of tips and tricks and lessons learned regarding windows 8 modern UI app developement. Topics include: Blend/design time data, view states, touch, navigation and Windows Store.

Citation preview

Page 1: Win8 development lessons learned jayway

Windows Store apps

lessons learned

@andyhammar - [email protected]

@roberthedgate - [email protected]

[email protected]

Page 2: Win8 development lessons learned jayway

Windows StoreView states

Store

What we’ve done

Navigation

Blend

Touch

Page 3: Win8 development lessons learned jayway

What we’ve done

Page 4: Win8 development lessons learned jayway
Page 5: Win8 development lessons learned jayway
Page 6: Win8 development lessons learned jayway
Page 7: Win8 development lessons learned jayway
Page 8: Win8 development lessons learned jayway
Page 9: Win8 development lessons learned jayway
Page 10: Win8 development lessons learned jayway

Blend

Page 11: Win8 development lessons learned jayway

Design time data

Design time view model

AppBar binding

Page 12: Win8 development lessons learned jayway

Design time view model

Windows.ApplicationModel.DesignMode.DesignModeEnabled

Page 13: Win8 development lessons learned jayway

AppBar binding

Page 14: Win8 development lessons learned jayway

View states

Page 15: Win8 development lessons learned jayway

Windows 8 View States

Page 16: Win8 development lessons learned jayway

Full vs Filled vs Snapped

• Full view

• Filled view

• Snapped view

Page 17: Win8 development lessons learned jayway

Full view

Nothing strange about this, the normal state

Page 18: Win8 development lessons learned jayway

Filled view

• Usually nothing strange about this

• You have minimum of 1024 pixel of place,

might be more

• Can perhaps show a little less than in full

view

• Be aware that user might not reach

controls with their thumbs

Page 19: Win8 development lessons learned jayway

Filled view Store

Page 20: Win8 development lessons learned jayway

Snapped view

• You HAVE to support this, requirement

from Microsoft

• It is always 320 pixel wide

Page 21: Win8 development lessons learned jayway

Then how do we do a snapped view

Page 22: Win8 development lessons learned jayway

Use same view, reposition elements

Page 23: Win8 development lessons learned jayway

Use same view, reposition elements

• Difficult to maintain in blend

• Easy to accidently alter something in the

other when doing a change in one. We have

dependencies between states.

Page 24: Win8 development lessons learned jayway

Use same view with visibility

• Could very easy create duplicate data

• Make sure you use usercontrols, bindings etc

Page 25: Win8 development lessons learned jayway

Navigate to a different page

• Catch OnSizeChanged

• ApplicationView.Value will tell you your state.

• Do your navigation etc here.

• Advantage if you want your app to always show

the same snapped content. Tip: Put this in a

base class.

Page 26: Win8 development lessons learned jayway

Summary

Use separate snapped view, either by

using visibility or navigate.

Page 27: Win8 development lessons learned jayway

Touch

Page 28: Win8 development lessons learned jayway

Touch

...just works

Page 29: Win8 development lessons learned jayway

Pointer events

PointerPressed, PointerReleased, PointerM

ovedPointerCanceled, PointerCaptureLost, PointerEntered, Poin

terExited, PointerWheelChanged

Page 30: Win8 development lessons learned jayway

Pointer events

• e.GetCurrentPoint().PointerId

.Properties.IsMiddleButtonPressed

• e.GetIntermediatePoints

Page 31: Win8 development lessons learned jayway

Static gestures

• Derived from Pointer-events

Tapped

DoubleTapped

Holding

RightTapped

• One concurrent event per UI Element

Page 32: Win8 development lessons learned jayway

Manipulation gesture events

ManipulationStarted, ManipulationCompleted

ManipulationDelta,ManipulationInertiaStarting, ManipulationStarting

Page 33: Win8 development lessons learned jayway

Manipulation gesture events

• Inertia

• Often used to set RenderTransform

• Derived from Pointer-events

• One concurrent event per UI Element

Page 34: Win8 development lessons learned jayway

Brainstormer

Page 35: Win8 development lessons learned jayway

Screen table - "Surface"/FlatFrog

no up or down

difficult with global UI elements

Use popups or duplicates

Page 36: Win8 development lessons learned jayway

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 37: Win8 development lessons learned jayway

Manipulation transforms

CompositeTransform

e.Cumulative.Rotation

No concurrent Repeatbuttons

e.handled = true

Page 38: Win8 development lessons learned jayway

Navigation

Page 39: Win8 development lessons learned jayway

Windows 8 Navigate

Page 40: Win8 development lessons learned jayway

Rootframe

• Add a seperate rootframe over the existing one.

• Background

• Animation

• Audio

Page 41: Win8 development lessons learned jayway

Rootframe, xaml

Page 42: Win8 development lessons learned jayway

Rootframe, code behind

Page 43: Win8 development lessons learned jayway

Navigate static class

We have to handle Navigate, Back, CanGoBack etc

Page 44: Win8 development lessons learned jayway

Parameter serialization & suspend

• Now there is a possibility to use object to navigate by. Great?

• It was only possible to use strings before.

• Now these types can be serialized by Frame.GetNavigationState:• numbers

• characters

• strings

• guids

• boolean

Page 45: Win8 development lessons learned jayway

Parameter serialization & suspend

GetNavigationState doesn't support serialization of a

parameter type which was passed to Frame.Navigate

Page 46: Win8 development lessons learned jayway

Parameter serialization & suspend

There are a few ways around this example:

• Use strings (or other approved types)

• In your complexd object serialize and

deserialize manually using strings.

• Save object globally and reference object by

strings when navigate

Page 47: Win8 development lessons learned jayway

page caching

Page caching works both back and forward

• You can not just turn on caching back which is

what we usually want to have

Page 48: Win8 development lessons learned jayway

backstack clearing

How to clear cache?

Page 49: Win8 development lessons learned jayway

Summary

It is nice to use a own rootframe to be

able to have the same background

image/animation/sound etc in all views

It is more convenient to use approved

parameters until all serializable object are

allowed

If you turn on page caching make sure

you clear the cache on the correct level

Page 50: Win8 development lessons learned jayway

Windows Store

Page 51: Win8 development lessons learned jayway

Windows Store

Publish WACK

Privacy policy

Live account

Publisher name

Background audio

Manage Change app name

Remove app

Page 52: Win8 development lessons learned jayway

WACK

Is step 1 of certification process always run this.

Page 53: Win8 development lessons learned jayway

Privacy policy

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

Must have in metadata and accessible in app.

Page 54: Win8 development lessons learned jayway

Live account

Use separate live-ID for win8 apps.

Page 55: Win8 development lessons learned jayway

Publisher name

For company accounts, ”must” match registration papers.

Page 56: Win8 development lessons learned jayway

Background audio

Background audio prevents suspend, do not autoplay!

Page 57: Win8 development lessons learned jayway

Change app name

App name can be changed.

Page 58: Win8 development lessons learned jayway

Remove app

Apps cannot be removed, only updated to no markets.

Page 59: Win8 development lessons learned jayway

Thank you for coming!

the end