350 likes | 488 Views
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.
E N D
LAMAD Windows Phone 7 20.3.2013
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 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 Version 8 just appeared 2012! Future is not yet clear Game development maybe? Windows Phone 8
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 2. xap file is created on compile. Note!Unlock the device before any operation!
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 World Task: “Adding a clickable check box to our main page.” When creating a new Solution, under the default project name we can spot the: • MainPage.xaml • MainPage.xaml.cs Double click the MainPage.xaml file.
Hello World Drag and drop CheckBox from Toolbox . XAML code is created in: MainPage.xaml
Compile and Run Debug > StartDebugging [F5] ‘Play’ button shortcut Select test environment
Publish App! Login at http://create.msdn.com/ and complete steps 1 and 2
Working with Location Native location handling object (watcher) Initialize watcher We want to get position updates often
Working with Location attempt to start location services Complete to handle every state of the watcher. HOMEWORK
Working with Location Taking location from event args Uninitialize Objects
Adding a Map Drag map from ToolBox. Remove extra XAML. Name is enough!
Adding a Marker Open the MainPage.xaml.cs file Change the location to reflect user location. Hint: Study the positionChanged function described earlier. HOMEWORK
Test on Emulator Powerful 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.
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 base class (superclass) Animal talk(){ // not implemented } subclasses inheritance Cat Dog Duck talk(){ print (“meow”); } talk(){ print (“woof”); } talk(){ print (“quack”); } Animal tom = new Cat(); Animal mopsi = new Dog(); Animal donald = new Duck(); tom.talk(); // prints “meow” mopsi.talk(); // prints “woof” donald.talk(); // prints “quack” http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming
Request types Animal Request Cat Dog Duck LoginReq ShareLocationReq UsersDataReq
Examples Requesting friends active in the last week The process is fully encapsulated!
JSON request base class Serializing as JSON string Need to implement In each subclass
Publically available method talk() from Animal example asynchronous
Sending request information JSON from ToString() method asynchronous {"lat":"62.6","lon":"29.7","request_type":"user_location","userid":"2"}
Reading server response Handling good/bad response
Implementing a subclass location Server has a list of these. User ID is global