lamad

35
LAMAD Windows Phone 7 20.3.2013

Upload: medge-gillespie

Post on 02-Jan-2016

24 views

Category:

Documents


2 download

DESCRIPTION

LAMAD. Windows Phone 7 20.3.2013. Part 1 The Platform and SDK. Windows Phone 7. Mobile OS Developed by Microsoft Appeared in the US in 2010 Mango in 2011 Tango in 2012. Live Tiles. Nokia Lumia 800. Market Share. Market Share 2012 . There is Hope!. Technology. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: LAMAD

LAMADWindows Phone 7

20.3.2013

Page 2: LAMAD

Part 1

The Platform and SDK

Page 3: LAMAD

Windows Phone 7

Mobile OSDeveloped by MicrosoftAppeared in the US in 2010Mango in 2011Tango in 2012

Live Tiles

Nokia Lumia 800

Page 4: LAMAD

Market Share

Market Share 2012 There is Hope!

Page 5: LAMAD

Technology

Application development in C# or VB

GUI design in XAML (Extensible Application Markup Language) Declarative XML-based language Created by Microsoft

Page 6: LAMAD

Future of the OS

Future is not yet clear

Windows Phone 8

Version 8 just appeared 2012!

Game development maybe?

Page 7: LAMAD

Installing development Kit

Newest Software Development Kit (SDK) version is 8.0.

It is free to download from http://create.msdn.com/.

Note! You need Windows 8 to use the newest SDK. We use 7.1.

Page 8: LAMAD

SDK contents

• Microsoft Visual Studio [Programming tool]

• Expression Blend [Designing tool]

• Project templates [Out of the box code]

• Windows Phone Emulator [Test app without a device]

• Additional tools [Register, deploy apps, etc.]

Page 9: LAMAD

Testing on device

1. Register:• Fee is 99 €/year • Up to 100 apps• Students = free!

2. Registration tool

3. Install Zune:http://www.windowsphone.com/en-us/how-to/wp7/zune-

software.

Page 10: LAMAD

Deploy on a device

1. Deployment tool

Note! Unlock the device before any operation!

2. xap file is created on compile.

Page 11: LAMAD

Access to Store

http://create.msdn.com/

• Publish, un-publish• Upgrade apps• Beta publishing• Check statistics• Modify pricing• Monitor crashes

MOPSI stats on marketplace

Page 12: LAMAD

Hello WorldTask: “Adding a clickable check box to our main page.”

When creating a new Solution, under the default project name we can spot the:

Double click the MainPage.xaml file.

• MainPage.xaml

• MainPage.xaml.cs

Page 13: LAMAD

Hello World

XAML code is created in:MainPage.xaml

Drag and drop CheckBox from Toolbox .

Page 14: LAMAD

Compile and Run

Debug > Start Debugging [F5]

Select test environment

‘Play’ button shortcut

Page 15: LAMAD

Publish App!

Login at http://create.msdn.com/ and complete steps 1 and 2

Page 16: LAMAD

Part 2

Location

Page 17: LAMAD

Working with LocationNative location handling object (watcher)

Initialize watcher

We want to get position updates often

Page 18: LAMAD

Working with Location

Complete to handle every state of the watcher.

HOMEWORK

attempt to start location services

Page 19: LAMAD

Working with Location

Uninitialize Objects

Taking location from event args

Page 20: LAMAD

Adding a Map

Drag map from ToolBox.

Remove extra XAML. Name is enough!

Page 21: LAMAD

Adding a MarkerOpen the MainPage.xaml.cs file

Change the location to reflect user location.Hint: Study the positionChanged function described earlier.

HOMEWORK

Page 22: LAMAD

Test on EmulatorPowerful tool to virtually update the position

Page 23: LAMAD

Map Credentials

We see the following message on the map:

Enter a Map Key obtained from the specified URL.

Note! Implement a Map Handler if you use maps on more pages.Keep the key in one place because map keys change often.

Page 24: LAMAD

Part 3

JSON, HTTP request

Page 25: LAMAD

Mobile – Server

Page 26: LAMAD

JSON

{"name": "mopsi","age": 4,"address": {"streetAddress": "länsikatu 15","city": "joensuu"},"users": [{"name": "pasi","location": "länsikatu 15"},{"name": "matti","location": "länsikatu 15"}]}

http://json.parser.online.fr/

Page 27: LAMAD

JSON in Windows Phone

Native JSON Support

Remember UTF – 8

Page 28: LAMAD

Subtype Polymorphism

Animal tom = new Cat();Animal mopsi = new Dog();Animal donald = new Duck();

tom.talk(); // prints “meow”mopsi.talk(); // prints “woof”donald.talk(); // prints “quack”

Animal

Cat Dog Duck

talk(){ // not implemented }

talk(){ print (“meow”);}

talk(){ print (“woof”);}

talk(){ print (“quack”);}

inheritance

base class (superclass)

subclasses

http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming

Page 29: LAMAD

Request typesAnimal

Cat Dog Duck

Request

LoginReq ShareLocationReq UsersDataReq

Page 30: LAMAD

Examples

Requesting friends active in the last week

The process is fully encapsulated!

Page 31: LAMAD

JSON request base class

Serializing asJSON string

Need to implement In each subclass

Page 32: LAMAD

Publically available method

talk() from Animal example

asynchronous

Page 33: LAMAD

Sending request information

asynchronous

JSON from ToString() method

{"lat":"62.6","lon":"29.7","request_type":"user_location","userid":"2"}

Page 34: LAMAD

Reading server response

Handling good/bad response

Page 35: LAMAD

Implementing a subclass

locationServer has a list of these.

User ID is global