windows phone 8 - från lapp till app

96
Windows Phone 8 – Från lapp till app Jimmy Engström, Antropoid

Upload: jimmy-engstroem

Post on 10-May-2015

409 views

Category:

Technology


1 download

DESCRIPTION

A presentaion in Swedish about how to take your app from idea to more or less finished app. We talk about Portalble Class Library, MVVM, XAML and a lot more.

TRANSCRIPT

Page 1: Windows phone 8 - Från lapp till app

Windows Phone 8 – Från lapp till appJimmy Engström, Antropoid

Page 2: Windows phone 8 - Från lapp till app

Vem är jag?

ASP.NET på dagenWindows phone &Windows 8 på kvällenGeek

Page 3: Windows phone 8 - Från lapp till app

Från lapp till app

Page 4: Windows phone 8 - Från lapp till app

Från lapp till app

Page 5: Windows phone 8 - Från lapp till app

Från lapp till app

Page 6: Windows phone 8 - Från lapp till app

Verktygen

Page 7: Windows phone 8 - Från lapp till app

Dev Center & Tools

Dev CenterDesign GuidelinesDeveloper Tools & SDKsVideor, Bloggar, Exempelhttp://developer.windowsphone.com/

ToolsVisual Studio, Blend, Emulator, Device Unlock, App Deploy, Store Test Kit

Page 8: Windows phone 8 - Från lapp till app

Visual Studio

Kod(Design)

Page 9: Windows phone 8 - Från lapp till app

Blend

DesignAnimeringar(Kod)

Page 10: Windows phone 8 - Från lapp till app

Windows Phone 8 SDK

Visual StudioBlendEmulatorDevice UnlockApp DeployStore Test KitKräverWindows 8Windows 8 pro

Page 11: Windows phone 8 - Från lapp till app

Design principles

Page 12: Windows phone 8 - Från lapp till app

Design Principer

Pride in craftmanshipMore with lessFast and fluidAuthentically digitalWin as one

Page 13: Windows phone 8 - Från lapp till app

Pride in craftmanship

Page 14: Windows phone 8 - Från lapp till app

Pride in craftmanship

Page 15: Windows phone 8 - Från lapp till app

Pride in craftmanship

Page 16: Windows phone 8 - Från lapp till app

More with less

Page 17: Windows phone 8 - Från lapp till app

More with less

Page 18: Windows phone 8 - Från lapp till app

Fast and fluid

Page 19: Windows phone 8 - Från lapp till app

Fast and fluid

Page 20: Windows phone 8 - Från lapp till app

Authentically digital

Page 21: Windows phone 8 - Från lapp till app

Win as one

Page 22: Windows phone 8 - Från lapp till app

App process

Page 23: Windows phone 8 - Från lapp till app

Idé

Behöver inte vara unikVar bäst på någotDataLagomHitta användaren

Page 24: Windows phone 8 - Från lapp till app

Funktioner

Skriv upp funktionerAvgränsaSe över eller skapa APIAndra tjänster?

Page 25: Windows phone 8 - Från lapp till app

Struktur

IndelningSidor

Page 26: Windows phone 8 - Från lapp till app

Skissa

Skissa ett gränssnitt(Funktioner och Data)

http://developer.windowsphone.com/en-us/design/process

Page 27: Windows phone 8 - Från lapp till app

Börja koda

Page 28: Windows phone 8 - Från lapp till app

Kontroller

Page 29: Windows phone 8 - Från lapp till app

Panorama

Page 30: Windows phone 8 - Från lapp till app

Pivot

Page 31: Windows phone 8 - Från lapp till app

ApplicationBar

Page 32: Windows phone 8 - Från lapp till app

ApplicationBar.Mode=ApplicationBarMode.Minimized;

ApplicationBar - Minimized

Page 33: Windows phone 8 - Från lapp till app

ButtonHyperlinkButtonCheckboxSlider

Buttons

Page 34: Windows phone 8 - Från lapp till app

LongListSelector

Page 35: Windows phone 8 - Från lapp till app

CapabilitiesID_CAP_MAPID_CAP_LOCATION

ApplicationIdAuthenticationToken

Karta

Page 36: Windows phone 8 - Från lapp till app

Webbrowser Control

Page 37: Windows phone 8 - Från lapp till app

Mediaplayer

Page 38: Windows phone 8 - Från lapp till app

Progress och Popup

Page 39: Windows phone 8 - Från lapp till app

Fler kontroller

Page 40: Windows phone 8 - Från lapp till app

Via Nugethttp://phone.codeplex.com/

Windows Phone ToolkitContextMenuDateTimePickersEffects – SlideInEffect, TiltEffect, TurnstileFeatherEffectHubTileListPickerLongListMultiSelectorMap extensionsToggleSwitchNavigation transitionsWrapPanel

Page 41: Windows phone 8 - Från lapp till app

Telerik

$9960 Kontroller

http://www.telerik.com/products/windows-phone.aspx

Page 42: Windows phone 8 - Från lapp till app

Syncfusion

$9925 Kontroller

http://www.syncfusion.com/products/windows-phone

Page 43: Windows phone 8 - Från lapp till app

Projekttyper

Page 44: Windows phone 8 - Från lapp till app

Panorama App

Page 45: Windows phone 8 - Från lapp till app

Pivot App

Page 46: Windows phone 8 - Från lapp till app

Databound App

Page 47: Windows phone 8 - Från lapp till app

Xaml and Direct 3D

Page 48: Windows phone 8 - Från lapp till app

timer = new GameTimer();timer.UpdateInterval = TimeSpan.FromTicks(333333);timer.Update += OnUpdate;timer.Draw += OnDraw;

private void OnDraw(object sender, GameTimerEventArgs e){ SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);}

Xaml and XNA

Page 49: Windows phone 8 - Från lapp till app

Audio Playback AgentAudio Streaming AgentScheduled Task Agent

Agents

Page 50: Windows phone 8 - Från lapp till app

Windows Phone App

Page 51: Windows phone 8 - Från lapp till app

Capabilities

Page 52: Windows phone 8 - Från lapp till app

Capabilities

ID_CAP_APPOINTMENTSID_CAP_CONTACTSID_CAP_GAMERSERVICESID_CAP_IDENTITY_DEVICEID_CAP_IDENTITY_USERID_CAP_ISV_CAMERAID_CAP_LOCATIONID_CAP_MAPID_CAP_MEDIALIBID_CAP_MEDIALIB_AUDIOID_CAP_MEDIALIB_VIDEOID_CAP_MEDIALIB_PHOTOID_CAP_MEDIALIB_PLAYBACK

ID_CAP_MICROPHONEID_CAP_NETWORKINGID_CAP_PHONEDIALERID_CAP_PROXIMITYID_CAP_PUSH_NOTIFICATIONID_CAP_REMOVABLE_STORAGEID_CAP_RINGTONE_ADDID_CAP_SENSORSID_CAP_SPEECH_RECOGNITIONID_CAP_VOIPID_CAP_WALLET

ID_CAP_WALLET_PAYMENTINSTRUMENTSID_CAP_WALLET_SECUREELEMENTID_CAP_WEBBROWSERCOMPONENTID_HW_FRONTCAMERA

Page 53: Windows phone 8 - Från lapp till app

XAML

Page 54: Windows phone 8 - Från lapp till app

XAML (zamel)

eXtensible Application Markup Language

Skapa objektSätta egenskaperResurser (Styles)Templates

Page 55: Windows phone 8 - Från lapp till app

XAML

Man kan ändra ”allt”

Button:<Border … >

<ContentControl … /></Border>

Page 56: Windows phone 8 - Från lapp till app
Page 57: Windows phone 8 - Från lapp till app

XAML Namespaces

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

Page 58: Windows phone 8 - Från lapp till app

XAML Namespaces - prefix

xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"

Page 59: Windows phone 8 - Från lapp till app

XAML Namespaces – design prefix

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"mc:Ignorable="d"

<phone:PhoneApplicationPage d:DesignWidth="640" d:DesignHeight="480“>

Page 60: Windows phone 8 - Från lapp till app

Application Lifecycle

Page 61: Windows phone 8 - Från lapp till app

Application Lifecycle - Dormant

running

deactivated

dormant

activated

Spara State!

Page 62: Windows phone 8 - Från lapp till app

Application Lifecycle - Tombstoned

running

deactivated

dormantTombstoned

activated

Spara State!

Page 63: Windows phone 8 - Från lapp till app

Grunderna - avklarade

VerktygenDesign principlesIdé och skissKontrollerProjekttyperCapabilitiesXamlApplication Lifecycle

Page 64: Windows phone 8 - Från lapp till app

Navigering

Page 65: Windows phone 8 - Från lapp till app

NavigationService.Navigate(new Uri("/secondpage.xaml?parameter=test", UriKind.Relative));

if (NavigationContext.QueryString.TryGetValue("parameter", out parameter)){

ParameterTextBlock.Text = parameter;}

Sidor och navigering

Page 66: Windows phone 8 - Från lapp till app

Launchers & Choosers

Page 67: Windows phone 8 - Från lapp till app

Launchers & Choosers

AddressChooserTask MapsTask SaveContactTask

AddWalletItemTask MapUpdaterTaskSaveEmailAddressTask

BingMapsDirectionsTask MarketplaceDetailTaskSavePhoneNumberTask

BingMapsTask MarketplaceHubTask SaveRingtoneTaskCameraCaptureTask MarketplaceReviewTask SearchTaskConnectionSettingsTask MarketplaceSearchTask ShareLinkTaskEmailAddressChooserTask MediaPlayerLauncher ShareMediaTaskEmailComposeTask PhoneCallTask ShareStatusTask

GameInviteTaskPhoneNumberChooserTask SmsComposeTask

MapDownloaderTask PhotoChooserTask WebBrowserTaskMapsDirectionsTask SaveAppointmentTask

Page 68: Windows phone 8 - Från lapp till app

Notifications

Page 69: Windows phone 8 - Från lapp till app

Alarm / Reminder

Reminder

Länk in i appenKan vara återkommande

Alarm

Ingen länk Kan ändra ljud Kan vara återkommande

Page 70: Windows phone 8 - Från lapp till app

MVVM & PCL

Page 71: Windows phone 8 - Från lapp till app

MVVM – Varför?

Återanvändning av kodTestbarhetLätt att hålla ordning påKan visa design-time data i Expression Blend och Visual Studio

Page 72: Windows phone 8 - Från lapp till app

MVVM

ModelViewViewModel

Page 73: Windows phone 8 - Från lapp till app

Model-View-ViewModel

View

ViewModel

Commands

Data Binding

Model

Page 74: Windows phone 8 - Från lapp till app

Model

Model

public class Person{

public string Name{ get; set; } public string Age{ get; set; }}

Page 75: Windows phone 8 - Från lapp till app

ViewModel - INotifyPropertyChanged

public class MainViewModel : INotifyPropertyChanged{ public event PropertyChangedEventHandler PropertyChanged;

private void NotifyPropertyChanged(String propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (null != handler) { handler(this, new PropertyChangedEventArgs(propertyName)); } }}

ViewModel

Page 76: Windows phone 8 - Från lapp till app

ViewModel

ViewModel

private string _sampleProperty = "my start value";public string SampleProperty{ get { return _sampleProperty; } set { _sampleProperty = value; NotifyPropertyChanged("SampleProperty"); }}

Page 77: Windows phone 8 - Från lapp till app

View

Binder text mot DataContext.SampleProperty

View

<TextBox Text="{Binding SampleProperty, Mode=TwoWay}" />

Page 78: Windows phone 8 - Från lapp till app

View - Listor

View

<phone:LongListSelector ItemsSource="{Binding MyListOfItems}" SelectedItem="{Binding MySelectedItem, Mode=TwoWay}" />

Page 79: Windows phone 8 - Från lapp till app

Data Binding Modes

<TextBox Text="{Binding SampleProperty, Mode=TwoWay}" />

OneTime – ViewModel -> kontrollen (en gång)OneWay – ViewModel -> kontrollen (en (varje gång)TwoWay – ViewModel <-> kontrollen (en (varje gång)

Page 80: Windows phone 8 - Från lapp till app

Commands

<Button Command="{Binding AddCommand}" CommandParameter="Untitled" Content="Button“ />

class AddItemCommand : ICommand{ ViewModel _viewModel; public AddItemCommand(ViewModel viewModel) { _viewModel = viewModel; } public event EventHandler CanExecuteChanged; public bool CanExecute(object parameter) { return true; }  public void Execute(object title) { _viewModel.AddItem(title as string); }}

Page 81: Windows phone 8 - Från lapp till app

Portable Class Library

Projekt typMinsta gemensamma nämnare

Page 82: Windows phone 8 - Från lapp till app

Spara data

PCL Storagehttps://pclstorage.codeplex.com/

Page 83: Windows phone 8 - Från lapp till app

Möjligheterna

Page 84: Windows phone 8 - Från lapp till app

Demo

MVVM, Portal Class Library och Windows 8

Page 85: Windows phone 8 - Från lapp till app

Live tile & toast

Page 86: Windows phone 8 - Från lapp till app

Live Tiles

Snabb information

Saker vi bryr oss om

UppdaterasInnifrån appen

Background Agent

Push Notification

Page 87: Windows phone 8 - Från lapp till app

Flip Tile Template

Crossdomain.xml

Page 88: Windows phone 8 - Från lapp till app

Cycle Tile Template

Page 89: Windows phone 8 - Från lapp till app

Iconic Tile Template

Page 90: Windows phone 8 - Från lapp till app

Toast Template

(wp:Text1)(wp:Text2)

Page 91: Windows phone 8 - Från lapp till app

Background Agents

Page 92: Windows phone 8 - Från lapp till app

Background agents

PeriodicTask30:e minut (+-10min)25 sekunder

ResourceIntensiveTaskLaddare / UsbWifi eller PC-uppkoppling>90% batteri10 minuter

Page 93: Windows phone 8 - Från lapp till app

Demo

Live tile, Toast och Background Task

Page 94: Windows phone 8 - Från lapp till app

Avslutningsvis

Använd Windows Phones kontrollerAnvänd MVVMBygg för båda

Page 95: Windows phone 8 - Från lapp till app

Coding After Work

www.CodingAfterWork.se

Page 96: Windows phone 8 - Från lapp till app

Tack!

Kontakta mig gärna om ni behöver hjälp, stöd eller bollplank.

Jimmy Engströ[email protected]@apeoholic.se