advance windows phone 7 development - akber alwani blog · advance windows phone development 7...
TRANSCRIPT
![Page 1: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/1.jpg)
Advance WindowsPhoneDevelopment
7
Akber AlwaniWindow Phone 7 DevelopmentEP.NET Professionals User Grouphttp://www.epdotnet.com
![Page 2: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/2.jpg)
Agenda
Page NavigationApplication Bar and System trayOrientation-Aware PagesPivots and PanoramaIsolated StorageQ&A
![Page 3: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/3.jpg)
Page Navigation
![Page 4: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/4.jpg)
Graphics Composition
Shell frame composes all UI into a single scene Central page management enables cross-app UI transitions and other effects System-wide Z-order enforcement emphasizes core phone functionality
![Page 5: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/5.jpg)
Frame and Page Frame
Top-level container control PhoneApplicationFrame class Contain the page control and system
elements such as system tray andapplication bar
Page Files the entire content region of the
frame PhoneApplicationPage-dervied class Contains a title Optionally surfaces its own application
bar
![Page 6: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/6.jpg)
Page Navigation
Silverlight on WindowsPhone uses a Page-basednavigation model Similar to web page model Each page identified by a URI Each page is essentially stateless
private void hyperlinkButton1_Click(object sender,RouteEventArgs e){
NavigationService.Navigate(new Uri(“/SecondPage.xaml”,UriKind.RelativeorAbsolute) )
}
![Page 7: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/7.jpg)
Page Navigation
Silverlight on WindowsPhone uses a Page-basednavigation model Similar to web page model Each page identified by a URI Each page is essentially stateless
private void hyperlinkButton1_Click(object sender,RouteEventArgs e){
NavigationService.Navigate(new Uri(“/SecondPage.xaml”,UriKind.RelativeorAbsolute) )
}
![Page 8: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/8.jpg)
Navigation Back Application can provide controls
on navigation back to precedingpage
private void Button1_Click(object sender, RouteEventArgs e){
NavigationService.GoBack();}
The hardware Back key will alsonavigate back to preceding page No code require- built-in behavior
![Page 9: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/9.jpg)
Passing Data Between Pages Can pass string data between pages using query strings:
On destination page:
![Page 10: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/10.jpg)
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
One solution for this is to store your ViewModel (i.e. data) onApp Class Global to whole application
Pass the selected item index inquery string
![Page 11: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/11.jpg)
DemoNavigation
![Page 12: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/12.jpg)
Application Bar
![Page 13: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/13.jpg)
Application ChromeSystem Tray and Application Bar System Tray
System owned indicator area that displays system-level status information
App can show/hideMicrosoft.Phone.Shell.SystemTray.Invisible= false;
Application Bar Area where application can display buttons for
the most common tasks Can display pop-up menu for less common
tasks
![Page 14: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/14.jpg)
Application Bar
Use the ApplicationBar instead ofcreating your own menu system
Up to 4 buttons plus optional menu Swipe up the bar to bring up the menu
Don’t fill all 4 slots if not needed Use white foreground on
transparent background for icons System will colorize button according to users
selected theme
![Page 15: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/15.jpg)
Application Bar in Xaml
![Page 16: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/16.jpg)
DemoApplication Bar
![Page 17: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/17.jpg)
Orientation-AwarePages
![Page 18: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/18.jpg)
Orientation Support In Visual-Studio ‘Add New Item’, you can add a Landscape Page or a Portrait Page In fact, any page can be either – or both PhoneApplicationPage.SupportedOrientation property states what orientations
the page supports Portrait Landscape PortraitOrLandscape
If set to PortraitOrLandscape, page will re-orientateitself automatically when user rotates the phone
You cannot force a page to re-orientate in code You can force a page to always use a specific orientation by setting the
SupportedOrientatios property to the value you require
![Page 19: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/19.jpg)
Orientation-Aware Pages
Can use a ScrollView to Scroll content when in landscape
![Page 20: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/20.jpg)
Demo
Handling OrientationChanges
![Page 21: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/21.jpg)
Storing Data inIsolated Storage
Settings and other data
![Page 22: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/22.jpg)
Isolated Storage
All I/O operationsrestricted to isolatedstorage Use Isolated File
storage to create afiles and foldersstructure hierarchy
Use Isolated Settingsstorage to storeapplication settings
![Page 23: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/23.jpg)
Isolated Storage Classes
IsolatedStorageFile Represent an isolated storage area containing files and
directories
IsolatedFileStream Exposes a files stream access to a file stored within
isolated storage
IsolagedStorageSettings Dictionary <(Of <(Tkey,Tvalue>)>) that stores key-value
pairs in isolated storage.
![Page 24: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/24.jpg)
Isolated Storage
Before you can use the isolated storage classes directlyyou need to bring in a couple of namespaces
You don’t need to add any references to your projectthough
The isolated storage can be managed and used as achunk of filestore Named filed and folders
using System.IO;using System.IO.IsloatedStorage;
![Page 25: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/25.jpg)
Saving Data
![Page 26: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/26.jpg)
Reading Data
![Page 27: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/27.jpg)
Application Settings
![Page 28: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/28.jpg)
DemoIsolated Storage
![Page 29: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/29.jpg)
Quota Management There is no quotas on Windows Phone! Applications must make careful use of space
Use only what is necessary Be transparent about storage usage
Manage application data Delete temporary data and files when no longer
required Consider synchronizing or archiving data to cloud to
reduce device storage
![Page 30: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/30.jpg)
Q&AApps navigate between pages using NavigationSerivce
You can pass data objects between pages by using Query String
An Application Bar can have up to four icons
You can change the display orientation of a Page in code at runtime
System auto orientates LandscapeOrPotrait forms on phone rotation
Apps navigate between pages using NavigationSerivce
You can pass data objects between pages by using Query String
An Application Bar can have up to four icons
You can change the display orientation of a Page in code at runtime
System auto orientates LandscapeOrPotrait forms on phone rotation
IsoloatedStorage is subject to 100MB Quota per application
You can create directories and files in isolagestorageYou can create directories and files in isolagestorage
IsoloatedStorage is subject to 100MB Quota per application
![Page 31: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/31.jpg)
Download All Presentation
http://bit.ly.epdotnet-wp7
![Page 33: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/33.jpg)
Pivots andPanorama
![Page 34: Advance Windows Phone 7 Development - Akber Alwani Blog · Advance Windows Phone Development 7 AkberAlwani Window Phone 7 Development EP.NETProfessionals User Group ... structure](https://reader033.vdocuments.us/reader033/viewer/2022060213/5f0554a07e708231d4126ee9/html5/thumbnails/34.jpg)
Pivots & Panorama
Best controls to build applications Easy to implement new Windows 7 user experience
Out-of-the-box behavior matches UX guidelinesand system behavior Graphically similar (lists of stuff, off-screen content)
Break up data into consumable chunks for user Physically similar (cyclical, left-to-right, gestures,
backstack)