Upload
wes-yanaga
View
1.129
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Special thanks to Daniel Egan. This presentation provides a deeper dive into Windows Phone 7 for developers. Topics cover how you navigate in your applicaton, how to access Web Services, use JSON to move data, and how to push notifications.
Citation preview
7
Windows Phone 7
Unleashed
Session II
Session 2 Agenda
Navigation Fragment Navigation Web Services Json Deserialzation Extras Menu Push Notifications Push Notifications Helper Library Shell Tile Scheduler Cloud Phone SDK Bing Maps
Navigation
Phone Application Frame
Frame Contains Page Control and other elements
Page fills the entire content region of the frame and contains the content
Phone Application Page
A page fills the entire content region of the frame. It includes the following characteristics:
Optionally surfaces its own application bar There are three main ways to navigate between pages in your
app: Using the PhoneApplicationPage virtual methods for handling the result of
navigation. HyperlinkButton - it provides NavigateUri property which can be used to
navigate to a page Uri.
NavigationService - it provides methods, properties, and events to support navigation within a wp7 application.
Note: The PhoneApplicationPage class supports OnNavigatedTo, OnNavigatedFrom and OnNavigatingFrom virtual methods for handling the result of navigation:
A Quick Lap around the Phone• Navigation• OnNavigatedTo override• Fragment Navigation• AppBar
Demo
NameTitleMicrosoft Corporation
Connecting to Web Services
10 Microsoft Confidential
Classic Development
Forward Looking
Web + Services
Application +
Services
Oriented around multiple
devices (x Screens)
Application – Oriented
around one device
(1 Screen)
Shifting Development Strategies
Networking for Windows Phone
Support for networking features: WCF HttpWebRequest WebClient No cross-domain policy file required ODATA
Not Supported Sockets Custom WCF Bindings (no duplex) WCF RIA Services NTLM authentication
12
Simple HTTP Request
WebClient client = new WebClient();
public SimpleWebClient() { InitializeComponent();
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
}
private void button1_Click(object sender, RoutedEventArgs e) { client.DownloadStringAsync( new Uri("http://localhost/ServicesApplication/whatever.xml"), "sample rss");
}
void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) { if (e.UserState as string == "sample rss") { this.progressBar1.Value = e.ProgressPercentage; } }
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { this.textBlock1.Text = e.Result; }
13
WCF ASMX Services
14
Restful Web Services
Use WCF Restful Services On Premise As a Azure WebRole
Data On premise In Cloud
Retrieve Lightweight rest services XML JSON
15
Using ODATA From WCF From SQL Azure From publishers – http://odata.org Odata Client Library for WP7
16
You Decide Simple Test Case : Downloaded 8 data records
Each Record had just four fields Measured bytes to transfer:
Odata version from WCF Data Services 8.5k
ASMX SOAP + Dataset - 3k REST + XML - 1.2k REST + JSON – 639bytes
17
The Extras Menu Add an xml file to
project
18
The Extras Menu Name it Extras.xml
19
The Extras Menu Add the following xml
A Quick Lap around the Phone• Connecting to Rest Service• Using Json (Data Contract
Serializer)• Adding your app to the extras
menu
Demo
Push Notifications
Push Notification Service
Built-in support for efficient, battery-aware mobile push notifications
Managed APIs for notification-driven interaction with existing Web 2.0 sites
Windows Phone Your Web Service
Custom Web Service
Existing Web Services
Microsoft Services
Push client service
Microsoft.Phone.Notification Notification
Service
PUSH NOTIFICATIONS: DATA FLOW
Push client
Push service
Your service
Tile
App
Toast
Send push data to URI
Send push data to
client
Send URI to server
Open push channelReturn URIData to App
Data to toast
Data to tile
Event
Windows Phone Microsoft confidential.
Push Notification Service
Seattle, WA: Sunny and 85 degrees
25
Shell Tile Scheduler
26
Shell Tile Scheduler
A Quick Lap around the Phone• Push Notification Helper• ScheduleTileService
Demo
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.