Your SlideShare is downloading. ×
Session 1
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Session 1

231
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
231
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Microsoft Leader club Session One – Dev Windows Phone 8 08/03/2013
  • 2. APP CAMPUS
  • 3. Get €50,000 for your Windows Phone app idea!The winner will also get a free trip to Finland toparticipate in a 4-week developer camp. Competefor the Worldwide Imagine Cup AppCampusAward! Top finalists incorporating a WindowsPhone app into their project are eligible to win.Through this mobile application acceleratorprogram, Microsoft and Nokia provide grants tofund innovative, first-to-market ideas with a freshapproach on design elegance, superior qualityand performance
  • 4. WINDOWS PHONE DEV CENTER
  • 5. The Windows Phone Emulator•The Windows Phoneemulator runs as a Hyper-Vvirtual machine on yourWindows PC• •It contains the same software as a “real” phone, but built for the Windows PC platform
  • 6. Page NavigationFrame and Page•Frame•Top-level container control•PhoneApplicationFrame class•Contains the page control and systemelements such as system tray andapplication bar•Page•Fills entire content region of the frame•PhoneApplicationPage-derived class•Contains a title•Optionally surfaces its own applicationbar
  • 7. Using a Grid to Aid Landscape Layout• <phone:PivotItem Header="recipe">• <Grid>• <Grid.ColumnDefinitions>• <ColumnDefinition Width="*"/>• <ColumnDefinition Width="Auto"/>• </Grid.ColumnDefinitions>• <Grid.RowDefinitions>• <RowDefinition Height="Auto"/>• <RowDefinition Height="240"/>• <RowDefinition Height="*"/>• <RowDefinition Height="Auto"/>• </Grid.RowDefinitions>• ...• </Grid>
  • 8. Handling Screen OrientationChangesSelecting OrientationsSupportedOrientations="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
  • 9. Moving Elements• private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) { if (this.Orientation == PageOrientation.LandscapeLeft || this.Orientation == PageOrientation.LandscapeRight) { DirectionsScrollViewer.SetValue(Grid.RowProperty, 1); DirectionsScrollViewer.SetValue(Grid.ColumnProperty, 1); } else { DirectionsScrollViewer.SetValue(Grid.RowProperty, 2); DirectionsScrollViewer.SetValue(Grid.ColumnProperty, 0); } }
  • 10. Page Navigation•XAML apps on Windows Phone usea page-based navigation model•Similar to web page model•Each page identified by a URI•Each page is essentially statelessprivate void HyperlinkButton_Click_1( object sender,RoutedEventArgs e){NavigationService.Navigate( newUri("/SecondPage.xaml", UriKind.Relative));}
  • 11. Navigating Back•Application can provide controls to navigateback to preceding page•The hardware Back key will also navigateback to preceding page•No code required – built-in behaviourprivate void Button_Click_1( object sender,RoutedEventArgs e){NavigationService.GoBack();}
  • 12. Passing Data Between Pages• •Can pass string data between pages using query stringsprivate void passParam_Click(object sender, RoutedEventArgs e) {NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=" + textBox1.Text,UriKind.Relative)); }• •On destination pageprotected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e){base.OnNavigatedTo(e);string querystringvalue = "";if (NavigationContext.QueryString.TryGetValue("msg", out querystringvalue))textBlock1.Text = querystringvalue; }
  • 13. 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
  • 14. 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
  • 15. Saving Dataprivate 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 messagewriter.Close();}}}
  • 16. Loading Dataprivate 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;}
  • 17. Capture CameraCode XAML<Button x:Name="CaptureCameraButton" Content="Capture Camera" Width="300" Height="100"Margin="0,81,156,426" Click="CaptureCameraButton_Click" /><Image Height="150" HorizontalAlignment="Left" Margin="12,348,0,0" Name="image1" Stretch="Fill"VerticalAlignment="Top" Width="200" />Code c#private void CaptureCameraButton_Click(object sender, RoutedEventArgs e){CameraCaptureTask cct = new CameraCaptureTask();cct.Completed += new EventHandler<PhotoResult>(cct_Completed);cct.Show();}void cct_Completed(object sender, PhotoResult e){BitmapImage bmp = new BitmapImage();bmp.SetSource(e.ChosenPhoto);image1.Source = bmp;}
  • 18. Get PHOTOCode XAML• <Button x:Name="GetPhotoButton" Content="Get Photo" Width="300" Height="100" Margin="0,242,156,265" Click="GetPhotoButton_Click" />• <Image Height="150" HorizontalAlignment="Left" Margin="12,348,0,0" Name="image2" Stretch="Fill" VerticalAlignment="Top" Width="200" />Code c#private void GetPhotoButton_Click(object sender, RoutedEventArgs e){PhotoChooserTask pct = new PhotoChooserTask();pct.Completed += new EventHandler<PhotoResult>(pct_Completed);pct.Show();}void pct_Completed(object sender, PhotoResult e){BitmapImage bmp = new BitmapImage();bmp.SetSource(e.ChosenPhoto);image2.Source = bmp;}
  • 19. Anwar YAHYAOUI• President du club Microsoft Leader• Email: anwar.yahyawi@live.fr• Mobile: (+216) 24 23 41 73