Download - Windows Phone 7 Workshop
![Page 1: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/1.jpg)
WP7 Developer Training
NGAN SEOK CHERN Academic Ops Program Manager | MVP ASP.NET/IIS [email protected]
![Page 2: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/2.jpg)
Windows Phone
Speaker Profile
NGAN SEOK CHERN
Microsoft Most Valuable Professional – ASP.NET/IIS
Microsoft Malaysia
2
![Page 3: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/3.jpg)
Windows Phone
Course Material
Slide
http://bit.ly/wEPuTn
Code
http://bit.ly/z4coxV
3
![Page 5: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/5.jpg)
Windows Phone
new experience new platform
new design
5
![Page 6: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/6.jpg)
Windows Phone
metro UI
6
![Page 7: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/7.jpg)
hub
![Page 8: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/8.jpg)
![Page 9: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/9.jpg)
![Page 10: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/10.jpg)
![Page 11: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/11.jpg)
![Page 12: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/12.jpg)
![Page 13: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/13.jpg)
hardware
![Page 15: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/15.jpg)
Windows Phone
Development Platform Experience
15
![Page 16: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/16.jpg)
Windows Phone
Application
![Page 17: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/17.jpg)
Windows Phone
![Page 18: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/18.jpg)
Windows Phone
![Page 19: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/19.jpg)
Windows Phone
![Page 20: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/20.jpg)
Windows Phone
![Page 21: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/21.jpg)
Windows Phone
![Page 22: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/22.jpg)
Windows Phone
![Page 23: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/23.jpg)
Windows Phone
![Page 24: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/24.jpg)
Windows Phone
![Page 25: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/25.jpg)
Windows Phone
![Page 26: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/26.jpg)
Windows Phone
![Page 27: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/27.jpg)
Windows Phone
![Page 28: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/28.jpg)
Windows Phone
![Page 30: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/30.jpg)
Windows Phone
![Page 31: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/31.jpg)
Windows Phone
Apps
Free or Paid
Trial mode
Unlimited paid apps can be published
31
![Page 32: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/32.jpg)
Windows Phone
Apps Submission in Vietnam No marketplace yet
Submission through 3rd party
Yalla Apps
App-Gateway
windows phone
marketplace 3rd party publisher apps
![Page 33: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/33.jpg)
Windows Phone
Marketplace Certification App-Gateway/Yalla – 1 to 3 working days to validate your
app submission entry
Marketplace – 3 to 5 working days to test and certify your app
Status will be updated at Dashboard
Your apps will be published to marketplace within 24 hours
If your apps failed certification, check error report and modify as per suggested
33
![Page 35: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/35.jpg)
Windows Phone
Advertisement
Attract extra income from free apps
Advertisement publisher from Microsoft
Microsoft Advertising pubCenter
3rd Party advertisement publishers:
AdMob
Smaato
![Page 36: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/36.jpg)
Windows Phone
AdMob
Taken over by Google
Windows Phone 7 SDK in Beta
Cover a huge range of countries
Tutorial:
http://code.google.com/mobile/ads/docs/wp7/fundamentals.html
Problem:
Current Beta version contain bug that will cause you app force closed
36
![Page 37: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/37.jpg)
Hello Windows Phone
NGAN SEOK CHERN Academic Ops Program Manager | MVP ASP.NET/IIS [email protected]
![Page 39: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/39.jpg)
Silverlight for Windows Phone Toolkit
NGAN SEOK CHERN Academic Ops Program Manager | MVP ASP.NET/IIS [email protected]
![Page 40: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/40.jpg)
Windows Phone
Silverlight for Windows Phone
Toolkit
Additional set of useful controls
Download at http://silverlight.codeplex.com/
Open source
![Page 42: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/42.jpg)
Windows Phone
Orientation-Aware
Tips
ScrollViewer – scroll content when in landscape
Grid/StackPanel over Canvas, since they respect layout
MinWidth/MaxWidth property values
Dynamic resizing vs hard-coded sizes
Transition animation done automatically
42
![Page 44: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/44.jpg)
Windows Phone
Configuration
Determine keyboard layout
Easy access to special characters
<TextBox InputScope="Number" ...
![Page 45: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/45.jpg)
Windows Phone
Supported Input Scope Default
Standard QWERTY layout
Text With autocorrect and text
suggestion
Url With .com and customized
Enter key for typing URLs
EmailSmtpAddress With .com and @ key
EmailNameOrAddress With .com and @ key, and
phone number layout
45
Maps Used to type a location to
search for on a map
TelephoneNumber 12-key layout
Search Semi-transparent layout with a
Search and .com key
NameOrPhoneNumber Standard layout with access to
phone number layout
Chat Uses intelligent features such as
abbreviations
![Page 47: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/47.jpg)
Windows Phone
System Tray & Application Bar System Tray
System indicator area that displays system-level status information
Apps can show/hide
Application Bar Area to display buttons for the most common
tasks
Can display pop-up menu for less common tasks
… Microsoft.Phone.Shell.SystemTray.IsVisible = false; …
![Page 48: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/48.jpg)
Windows Phone
Application Bar
48
![Page 49: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/49.jpg)
Windows Phone
Application Bar in Xaml
Automatically created for you when you create page using template
49
<phone:PhoneApplicationPage x:Class=“MyApp.MainPage” … > <phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar x:Name="AppBar" IsMenuEnabled="True"> <shell:ApplicationBar.Buttons> <shell:ApplicationBarIconButton x:Name="NewContactButton" IconUri="Images/appbar.new.rest.png" Text="New" Click="NewContactButton_Click"/> <shell:ApplicationBarIconButton x:Name="SearchButton" IconUri="Images/appbar.feature.search.rest.png" Text="Find" Click="SearchButton_Click"/> </shell:ApplicationBar.Buttons> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem x:Name="GenerateMenuItem" Text="Generate Data" Click="GenerateMenuItem_Click" /> <shell:ApplicationBarMenuItem x:Name="ClearMenuItem" Text="Clear Data" Click="ClearMenuItem_Click" /> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> </phone:PhoneApplicationPage.ApplicationBar>
![Page 50: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/50.jpg)
Windows Phone
App Bar & Landscape
50
![Page 52: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/52.jpg)
Windows Phone
Frame and Page
Page control holds
section content for
the application
Frame control
contains the page
control & other
elements such as the
system tray &
application bar
![Page 53: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/53.jpg)
Windows Phone
Page Navigation
53
Silverlight on Windows Phone uses a Page-based navigation model
Similar to web page model
Each page identified by a URI
Each page is essentially stateless
private void hyperlinkButton1_Click( object sender, RoutedEventArgs e) { NavigationService.Navigate( new Uri("/SecondPage.xaml", UriKind.RelativeOrAbsolute) ); }
![Page 54: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/54.jpg)
Windows Phone
Navigating Back
54
Application can provide controls to navigate back to preceding page
The hardware Back key will also navigate back to preceding page
No code required – built-in behaviour
private void button1_Click( object sender, RoutedEventArgs e) { NavigationService.GoBack(); }
![Page 55: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/55.jpg)
Windows Phone
Passing Data Between Pages Can pass string data between pages using query strings
55
On destination page
protected override void OnNavigatedTo( System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string msg = string.Empty;
if (NavigationContext.QueryString.TryGetValue("msg", out msg))
textBlock1.Text = msg;
}
private void passParam_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=" + textBox1.Text, UriKind.Relative)); }
![Page 56: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/56.jpg)
Windows Phone
Passing Objects Between Pages Often, you will need to pass a data object from one page to another
For example, the user selects an item in a list and navigates to a Details page
One solution is to store your ViewModel (that is, data) in your App class
Global to whole application
Pass the selected item index in query string
56
NavigationService.Navigate(
new Uri("/SecondPage.xaml+?Param=value" ,
UriKind.RelativeOrAbsolute
![Page 57: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/57.jpg)
Isolated Storage
57
NGAN SEOK CHERN Academic Ops Program Manager | MVP ASP.NET/IIS [email protected]
![Page 58: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/58.jpg)
Windows Phone
Isolated Storage
Use to save settings and custom data
Two type:
Data as key/value pairs
Files
Secure and sandboxed
Logical Folder Structure via APIs
No quota currently
Be responsible and inform/empower user
Reference: http://msdn.microsoft.com/en-us/library/ff402541(v=vs.92).aspx
![Page 59: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/59.jpg)
Windows Phone
Working with Key/Value Pairs Common use methods of IsolatedStorageSettings:
Add: Adds an entry to the dictionary for the key/value pair.
Contains: Determines whether the dictionary contains the specified key.
Remove: Removes the entry with the specified key.
59
private void btnSaveSetting_Click(object sender, RoutedEventArgs e) { IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; // No need for a dispatcher invoke, this will be quicker. if (!settings.Contains("key1")) settings.Add("key1", txtInput.Text); else settings["userData"] = txtInput.Text; settings.Save(); }
![Page 60: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/60.jpg)
Windows Phone
Working with Files
Common use methods of IsolatedStorageSettings:
GetUserStoreForApplication: Obtains user-scoped isolated storage that corresponds to the calling code's application identity.
FileExists: Determines whether the specified path refers to an existing file in the isolated store.
CreateFile: Creates a file in the isolated store.
OpenFile: Opens a file at a specified path by using the specified sharing and access options. This method returns an IsolatedStorageFileStream object that contains the file's stream.
DeleteFile: Deletes a file in the isolated store.
DirectoryExists: Determines whether the specified path refers to an existing directory in the isolated store.
CreateDirectory: Creates a directory in the isolated storage scope.
DeleteDirectory: Deletes a directory in the isolated storage scope.
Remove: Removes the isolated storage scope and all its contents.
60
![Page 61: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/61.jpg)
Build & Deployment
61
NGAN SEOK CHERN Academic Ops Program Manager | MVP ASP.NET/IIS [email protected]
![Page 62: Windows Phone 7 Workshop](https://reader030.vdocuments.us/reader030/viewer/2022020206/544b3684b1af9f844f8b4f15/html5/thumbnails/62.jpg)
Marketplace Test Kit
62
NGAN SEOK CHERN Academic Ops Program Manager | MVP ASP.NET/IIS [email protected]