This document summarizes content from a Microsoft Leader club session on developing Windows Phone 8 apps. It provides information on contests for Windows Phone app ideas with cash prizes. It also outlines tools for Windows Phone development like the emulator and covers key concepts like navigation between pages, orientation handling, and using isolated storage.
3. Get €50,000 for your Windows Phone app idea!
The winner will also get a free trip to Finland to
participate in a 4-week developer camp. Compete
for the Worldwide Imagine Cup AppCampus
Award! Top finalists incorporating a Windows
Phone app into their project are eligible to win.
Through this mobile application accelerator
program, Microsoft and Nokia provide grants to
fund innovative, first-to-market ideas with a fresh
approach on design elegance, superior quality
and performance
6. The Windows Phone Emulator
•The Windows Phone
emulator runs as a Hyper-V
virtual machine on your
Windows PC
• •It contains the same
software as a “real” phone,
but built for the Windows
PC platform
7. Page Navigation
Frame and Page
•Frame
•Top-level container control
•PhoneApplicationFrame class
•Contains the page control and system
elements such as system tray and
application bar
•Page
•Fills entire content region of the frame
•PhoneApplicationPage-derived class
•Contains a title
•Optionally surfaces its own application
bar
9. Handling Screen Orientation
Changes
Selecting Orientations
SupportedOrientations="Portrait«
SupportedOrientations="PortraitOrLandscape«
• •A XAML property for the phone application page lets
you select the orientation options available
• •Your application can bind to an event which is fired
when the orientation changes
11. Page Navigation
•XAML apps on Windows Phone use
a page-based navigation model
•Similar to web page model
•Each page identified by a URI
•Each page is essentially stateless
private void HyperlinkButton_Click_1( object sender,
RoutedEventArgs e)
{
NavigationService.Navigate( new
Uri("/SecondPage.xaml", UriKind.Relative));
}
12. Navigating Back
•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 Button_Click_1( object sender,
RoutedEventArgs e)
{
NavigationService.GoBack();
}
13. Passing Data Between Pages
• •Can pass string data between pages using query strings
private void passParam_Click(object sender, RoutedEventArgs e) {
NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=" + textBox1.Text,
UriKind.Relative)); }
• •On destination page
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string querystringvalue = "";
if (NavigationContext.QueryString.TryGetValue("msg", out querystringvalue))
textBlock1.Text = querystringvalue; }
14. Isolated Storage Classes
• •The IsolatedStorage classes are all in the System.IO.IsolatedStorage
namespace
• •IsolatedStorageFile
• •Represents an isolated storage area containing files and directories
• •IsolatedFileStream
• •Exposes a file stream access to a file stored within isolated storage
• •IsolatedStorageSettings
• •Dictionary<(Of <(TKey, TValue>)>) that stores key-value pairs in isolated
storage
15. Local Folder
• •All read-write I/O operations restricted to local folder
• •Create a files and folder structure hierarchy
• •Use Isolated Settings storage to store application settings
16. Saving Data
private void saveGameToIsolatedStorage(string message)
{
using (IsolatedStorageFile isf =
IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream rawStream =
isf.CreateFile("MyFile.store"))
{
StreamWriter writer = new StreamWriter(rawStream);
writer.WriteLine(message); // save the message
writer.Close();
}
}
}
17. Loading Data
private string loadString()
{
string result = null;
using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
if (isf.FileExists("Myfile.store")
{
using (IsolatedStorageFileStream rawStream = isf.OpenFile(filename,
System.IO.FileMode.Open)) {
StreamReader reader = new StreamReader(rawStream);
result = reader.ReadLine();
reader.Close();
}}}
return result;
}