lamad
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 PresentationTRANSCRIPT
LAMADWindows Phone 7
20.3.2013
Part 1
The Platform and SDK
Windows Phone 7
Mobile OSDeveloped by MicrosoftAppeared in the US in 2010Mango in 2011Tango in 2012
Live Tiles
Nokia Lumia 800
Market Share
Market Share 2012 There is Hope!
Technology
Application development in C# or VB
GUI design in XAML (Extensible Application Markup Language) Declarative XML-based language Created by Microsoft
Future of the OS
Future is not yet clear
Windows Phone 8
Version 8 just appeared 2012!
Game development maybe?
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.
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.]
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.
Deploy on a device
1. Deployment tool
Note! Unlock the device before any operation!
2. xap file is created on compile.
Access to Store
http://create.msdn.com/
• Publish, un-publish• Upgrade apps• Beta publishing• Check statistics• Modify pricing• Monitor crashes
MOPSI stats on marketplace
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
Hello World
XAML code is created in:MainPage.xaml
Drag and drop CheckBox from Toolbox .
Compile and Run
Debug > Start Debugging [F5]
Select test environment
‘Play’ button shortcut
Publish App!
Login at http://create.msdn.com/ and complete steps 1 and 2
Part 2
Location
Working with LocationNative location handling object (watcher)
Initialize watcher
We want to get position updates often
Working with Location
Complete to handle every state of the watcher.
HOMEWORK
attempt to start location services
Working with Location
Uninitialize Objects
Taking location from event args
Adding a Map
Drag map from ToolBox.
Remove extra XAML. Name is enough!
Adding a MarkerOpen the MainPage.xaml.cs file
Change the location to reflect user location.Hint: Study the positionChanged function described earlier.
HOMEWORK
Test on EmulatorPowerful tool to virtually update the position
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.
Part 3
JSON, HTTP request
Mobile – Server
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/
JSON in Windows Phone
Native JSON Support
Remember UTF – 8
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
Request typesAnimal
Cat Dog Duck
Request
LoginReq ShareLocationReq UsersDataReq
Examples
Requesting friends active in the last week
The process is fully encapsulated!
JSON request base class
Serializing asJSON string
Need to implement In each subclass
Publically available method
talk() from Animal example
asynchronous
Sending request information
asynchronous
JSON from ToString() method
{"lat":"62.6","lon":"29.7","request_type":"user_location","userid":"2"}
Reading server response
Handling good/bad response
Implementing a subclass
locationServer has a list of these.
User ID is global