Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Windows Store & Phone Devtop 10 differences@dotMorten
Who’s who?WindowsPhonePlatform of choiceC# since .NET 1.0 beta 2XAML fulltime since Silverlight v1.1Work: Building SDKs fo...
Who’s who #2What is your preferred coding language?C#VB.NETJavaScriptC++OtherWhat platform do you develop most for?Windows...
The Inspiration for This Talk• ArcGIS Runtime SDK for WindowsA Mapping SDK for Windows Phone, Store and Desktop.Core runti...
Use Portable Class Library if you canPro:Build, test and compile once.Con:Won’t work for UI codeCan’t use non-PCL librarie...
PCL And Shared Source TogetherWindows Phone8Portable Class LibrariesWindows 8ServicesViewModels (limited or abstract)Model...
Quick Code Share Demo
sounds too good to be true?99% harpmusicIt almost is...At least 99% shared code.What’s in the remaining 1%?1% drums
#if NETFX_CORE //Store#elif WINDOWS_PHONE //Phone#elif SILVERLIGHT //Silverlight or Phone#else //WPF/Desktop#endifOr combi...
1. Namespaces#if NETFX_COREusing Windows.UI.Xaml;#elseusing System.Windows;#endifPhone / WPF / Silverlight Windows StoreSy...
Windows Phone/WPF/Silverlightxmlns:local="clr-namespace:MyNamespace;assembly=MyApp"Windows Store XAMLxmlns:local="using:My...
3. Touch/Mouse/PenTouch is kind oflike a mouseEverything isjust a pointer
Windows Phone Windows StoreMouseEventHandler => PointerEventHandlerMouseLeftButtonDown => PointerPressedMouseMove => Point...
Windows Phone:Make web requests using “WebClient”Install NuGet package “Microsoft.Net.Http”Windows Store:Make web requests...
Use the Dispatcher to call the UI ThreadHowever they look different...5. The Dispatcher
Windows PhoneWindows Store:5. The Dispatcher #2
5. The Dispatcher #3
public class MyViewModel{public MyViewModel(){if(IsDesign) // <- different on every platformMyProperty = "Lorem Ipsum";els...
public bool IsDesign{get{#if NETFX_COREreturn Windows.ApplicationModel.DesignMode.DesignModeEnabled;#elif SILVERLIGHT // i...
Windows Phone:this.NavigationService.Navigate(new Uri("/MyPage.xaml?parameter="+param.ToString(),UriKind.Relative));this.N...
Windows Phone:protected override void OnNavigatedTo(NavigationEventArgs e){string parameter = NavigationContext.QueryStrin...
GridView  LongListSelector8. Controls #2
Windows StoreIf your app has internet access,it MUST have a privacy policy!Windows PhoneIf your app uses the location serv...
10. Where did it go?Phone StoreRoaming Settings ⛔ UI Controls System.Windows Windows.Xaml.UIBehaviors  ⛔Remote debugging...
ReferencesMSDN MagazineSharing Code between Windows Phone 8and Windows 8 Applicationshttp://esriurl.com/CodeShare1TechEd 2...
Questions?Blog (and slides):www.sharpgis.netTwitter:@dotMortenE-mail:mnielsen@esri.com
THANK YOU !
Top 10 Differences between developing Windows Phone and Store apps
Top 10 Differences between developing Windows Phone and Store apps
Upcoming SlideShare
Loading in …5
×

Top 10 Differences between developing Windows Phone and Store apps

23,258 views

Published on

Slides from IE Hackathon session (June 8 2013) on the differences between the Windows Phone and Windows Store APIs.

Published in: Technology, Education
  • Be the first to comment

Top 10 Differences between developing Windows Phone and Store apps

  1. 1. Windows Store & Phone Devtop 10 differences@dotMorten
  2. 2. Who’s who?WindowsPhonePlatform of choiceC# since .NET 1.0 beta 2XAML fulltime since Silverlight v1.1Work: Building SDKs formappingSilverlight, WPF, WindowsPhone, Windows StoreHobby:Same thing but I get to be boss Windows 8WPF
  3. 3. Who’s who #2What is your preferred coding language?C#VB.NETJavaScriptC++OtherWhat platform do you develop most for?Windows 8Windows PhoneWPFWindows FormsOther
  4. 4. The Inspiration for This Talk• ArcGIS Runtime SDK for WindowsA Mapping SDK for Windows Phone, Store and Desktop.Core runtime (C++ & DirectX)C++ interopC++/CX WinRT APIC# importsPublic .NET SDK (C#)Store Phone Desktop
  5. 5. Use Portable Class Library if you canPro:Build, test and compile once.Con:Won’t work for UI codeCan’t use non-PCL librariesNo Platform specific codeUse shared source only when you can’tPro:Can always fully use the platform.Can use non-PCL componentsCon:Likely more testing involved.Visual Studio gets a little “weird” about it.More stuff to compileOr… use them both!But why share source?
  6. 6. PCL And Shared Source TogetherWindows Phone8Portable Class LibrariesWindows 8ServicesViewModels (limited or abstract)ModelsViews (XAML)App LifecycleNavigationViews (XAML)ConvertersShared ViewModels (Add as Link)Storage, AlertsPlatform SpecificDifferent XAMLDifferent ControlsSame DataBindingsSame Commands forKey InteractionsConverters
  7. 7. Quick Code Share Demo
  8. 8. sounds too good to be true?99% harpmusicIt almost is...At least 99% shared code.What’s in the remaining 1%?1% drums
  9. 9. #if NETFX_CORE //Store#elif WINDOWS_PHONE //Phone#elif SILVERLIGHT //Silverlight or Phone#else //WPF/Desktop#endifOr combine them:#if NETFX_CORE || WINDOWS_PHONE#if !SILVERLIGHT#if SILVERLIGHT && !WINDOWS_PHONEEncapsulate platform specific code using#if [conditional]
  10. 10. 1. Namespaces#if NETFX_COREusing Windows.UI.Xaml;#elseusing System.Windows;#endifPhone / WPF / Silverlight Windows StoreSystem.Windows Windows.UI.XamlSystem.Windows.Media Windows.UISystem Windows.Foundation*SystemSystem.Size Windows.Foundation.Size*System.Windows.Media.ColorWindows.UI.ColorMicrosoft.Xna.Framework.Graphics.ColorWindows.UI.Color
  11. 11. Windows Phone/WPF/Silverlightxmlns:local="clr-namespace:MyNamespace;assembly=MyApp"Windows Store XAMLxmlns:local="using:MyNamespace"2. XAML Namespace declaration
  12. 12. 3. Touch/Mouse/PenTouch is kind oflike a mouseEverything isjust a pointer
  13. 13. Windows Phone Windows StoreMouseEventHandler => PointerEventHandlerMouseLeftButtonDown => PointerPressedMouseMove => PointerMovedMouseEnter/Exit => PointerEntered/ExitedTap => TappedDoubleTap => DoubleTappedHold => Holding3. Touch/Mouse/Pen #2
  14. 14. Windows Phone:Make web requests using “WebClient”Install NuGet package “Microsoft.Net.Http”Windows Store:Make web requests using “HttpClient”4. HttpClient vs. WebClientHttpClient
  15. 15. Use the Dispatcher to call the UI ThreadHowever they look different...5. The Dispatcher
  16. 16. Windows PhoneWindows Store:5. The Dispatcher #2
  17. 17. 5. The Dispatcher #3
  18. 18. public class MyViewModel{public MyViewModel(){if(IsDesign) // <- different on every platformMyProperty = "Lorem Ipsum";elseGenerateData();}public string MyProperty { get; set; }…}6. Generating Design Time Data
  19. 19. public bool IsDesign{get{#if NETFX_COREreturn Windows.ApplicationModel.DesignMode.DesignModeEnabled;#elif SILVERLIGHT // includes WINDOWS_PHONEreturn System.ComponentModel.DesignerProperties.IsInDesignTool;#else //WPFreturnSystem.ComponentModel.DesignerProperties.GetIsInDesignMode(this);#endif}}6. Generating Design Time Data#2
  20. 20. Windows Phone:this.NavigationService.Navigate(new Uri("/MyPage.xaml?parameter="+param.ToString(),UriKind.Relative));this.NavigationService.Navigate(new Uri("MyAssembly;component/MyPage.xaml", UriKind.Relative));Windows Store:this.Frame.Navigate(typeof(MyPage), param);7. Page Navigation
  21. 21. Windows Phone:protected override void OnNavigatedTo(NavigationEventArgs e){string parameter = NavigationContext.QueryString["parameter"];base.OnNavigatedTo(e);}Windows Store:protected override void OnNavigatedTo(NavigationEventArgs e){object parameter = e.Parameter;base.OnNavigatedTo(e);}7. Page Navigation
  22. 22. GridView  LongListSelector8. Controls #2
  23. 23. Windows StoreIf your app has internet access,it MUST have a privacy policy!Windows PhoneIf your app uses the location service,it MUST have an option to disable it!9. Certification Requirements
  24. 24. 10. Where did it go?Phone StoreRoaming Settings ⛔ UI Controls System.Windows Windows.Xaml.UIBehaviors  ⛔Remote debugging USB WiFi/LANDirectWrite, Direct2D ⛔ WritableBitmap.Render  ⛔RadialBrush  ⛔XNADeprecated(use DirectX)⛔(use DirectX)LOB Company Hub APIs  ⛔Binding.StringFormat  ⛔Native JavaScript Apps ⛔(use PhoneGap) Render DirectX to XAML DrawingSurface SurfaceImageSource
  25. 25. ReferencesMSDN MagazineSharing Code between Windows Phone 8and Windows 8 Applicationshttp://esriurl.com/CodeShare1TechEd 2013 SessionBuild It Once For Both: Writing Code andDesigning for Windows 8 and WindowsPhone 8http://esriurl.com/CodeShare2
  26. 26. Questions?Blog (and slides):www.sharpgis.netTwitter:@dotMortenE-mail:mnielsen@esri.com
  27. 27. THANK YOU !

×