Successfully reported this slideshow.
Your SlideShare is downloading. ×

Top 10 Differences between developing Windows Phone and Store apps

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Upcoming SlideShare
Windows Phone Introduction
Windows Phone Introduction
Loading in …3
×

Check these out next

1 of 29 Ad

More Related Content

Slideshows for you (20)

Similar to Top 10 Differences between developing Windows Phone and Store apps (20)

Advertisement

Recently uploaded (20)

Top 10 Differences between developing Windows Phone and Store apps

  1. 1. Windows Store & Phone Dev top 10 differences @dotMorten
  2. 2. Who’s who? Windows Phone Platform of choice C# since .NET 1.0 beta 2 XAML fulltime since Silverlight v1.1 Work: Building SDKs for mapping Silverlight, WPF, Windows Phone, Windows Store Hobby: Same thing but I get to be boss  Windows 8 WPF
  3. 3. Who’s who #2 What is your preferred coding language? C# VB.NET JavaScript C++ Other What platform do you develop most for? Windows 8 Windows Phone WPF Windows Forms Other
  4. 4. The Inspiration for This Talk • ArcGIS Runtime SDK for Windows A Mapping SDK for Windows Phone, Store and Desktop. Core runtime (C++ & DirectX) C++ interop C++/CX WinRT API C# imports Public .NET SDK (C#) Store Phone Desktop
  5. 5. Use Portable Class Library if you can Pro: Build, test and compile once. Con: Won’t work for UI code Can’t use non-PCL libraries No Platform specific code Use shared source only when you can’t Pro: Can always fully use the platform. Can use non-PCL components Con: Likely more testing involved. Visual Studio gets a little “weird” about it. More stuff to compile Or… use them both! But why share source?
  6. 6. PCL And Shared Source Together Windows Phone 8 Portable Class Libraries Windows 8 Services ViewModels (limited or abstract) Models Views (XAML) App Lifecycle Navigation Views (XAML) Converters Shared ViewModels (Add as Link) Storage, Alerts Platform Specific Different XAML Different Controls Same DataBindings Same Commands for Key Interactions Converters
  7. 7. Quick Code Share Demo
  8. 8. sounds too good to be true? 99% harp music It 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 #endif Or combine them: #if NETFX_CORE || WINDOWS_PHONE #if !SILVERLIGHT #if SILVERLIGHT && !WINDOWS_PHONE Encapsulate platform specific code using #if [conditional]
  10. 10. 1. Namespaces #if NETFX_CORE using Windows.UI.Xaml; #else using System.Windows; #endif Phone / WPF / Silverlight Windows Store System.Windows Windows.UI.Xaml System.Windows.Media Windows.UI System Windows.Foundation* System System.Size Windows.Foundation.Size* System.Windows.Media.Color Windows.UI.Color Microsoft.Xna.Framework.Graphics.Color Windows.UI.Color
  11. 11. Windows Phone/WPF/Silverlight xmlns:local="clr-namespace:MyNamespace;assembly=MyApp" Windows Store XAML xmlns:local="using:MyNamespace" 2. XAML Namespace declaration
  12. 12. 3. Touch/Mouse/Pen Touch is kind of like a mouse Everything is just a pointer
  13. 13. Windows Phone Windows Store MouseEventHandler => PointerEventHandler MouseLeftButtonDown => PointerPressed MouseMove => PointerMoved MouseEnter/Exit => PointerEntered/Exited Tap => Tapped DoubleTap => DoubleTapped Hold => Holding 3. 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. WebClient HttpClient
  15. 15. Use the Dispatcher to call the UI Thread However they look different... 5. The Dispatcher
  16. 16. Windows Phone Windows Store: 5. The Dispatcher #2
  17. 17. 5. The Dispatcher #3
  18. 18. public class MyViewModel { public MyViewModel() { if(IsDesign) // <- different on every platform MyProperty = "Lorem Ipsum"; else GenerateData(); } public string MyProperty { get; set; } … } 6. Generating Design Time Data
  19. 19. public bool IsDesign { get { #if NETFX_CORE return Windows.ApplicationModel.DesignMode.DesignModeEnabled; #elif SILVERLIGHT // includes WINDOWS_PHONE return System.ComponentModel.DesignerProperties.IsInDesignTool; #else //WPF return System.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  LongListSelector 8. Controls #2
  23. 23. Windows Store If your app has internet access, it MUST have a privacy policy! Windows Phone If 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 Store Roaming Settings ⛔  UI Controls System.Windows Windows.Xaml.UI Behaviors  ⛔ Remote debugging USB WiFi/LAN DirectWrite, Direct2D ⛔  WritableBitmap.Render  ⛔ RadialBrush  ⛔ XNA Deprecated (use DirectX) ⛔ (use DirectX) LOB Company Hub APIs  ⛔ Binding.StringFormat  ⛔ Native JavaScript Apps ⛔(use PhoneGap)  Render DirectX to XAML DrawingSurface SurfaceImageSource
  25. 25. References MSDN Magazine Sharing Code between Windows Phone 8 and Windows 8 Applications http://esriurl.com/CodeShare1 TechEd 2013 Session Build It Once For Both: Writing Code and Designing for Windows 8 and Windows Phone 8 http://esriurl.com/CodeShare2
  26. 26. Questions? Blog (and slides): www.sharpgis.net Twitter: @dotMorten E-mail: mnielsen@esri.com
  27. 27. THANK YOU !

Editor's Notes

  • System.Windows vs. Windows.UI.Xaml....System.Windows.MarkupWindows.UI.Xaml.MarkupSystem.Windows.MediaWindows.UISystem.SizeWindows.Foundation.SizeSystem.WindowsWindows.FoundationBe careful though:System.Windows.Media.Color vs. Windows.UI.Color: Exists on WP, but comes from WinRT types (+there&apos;s also an XNA version)
  • Pointers vs. MouseSystem.Windows.Input.MouseEventHandlerWindows.UI.Xaml.Input.PointerEventHandler WP: (Double)Tap, WinStore: (Double)Tapped WP: MouseLeftButtonDown, WinStore: PointerPressed
  • System.Windows.Input.MouseEventHandlerWindows.UI.Xaml.Input.PointerEventHandler WP: (Double)Tap, WinStore: (Double)Tapped WP: MouseLeftButtonDown, WinStore: PointerPressed
  • (use NuGet package, but no compression).. Include link to Gzip code + pcl
  • Switching to Dispatcher threadDispatcher.HasThreadAccessvsCheckAccess(), BeginInvoke, RunAsyncvar dispatcher = System.Windows.Deployment.Current.Dispatcher; var dispatcher = Windows.UI.Xaml.Window.Current.Dispatcher;
  • WinStoreWindows.ApplicationModel.DesignMode.DesignModeEnabledWinPhoneSystem.ComponentModel.DesignerProperties.IsInDesignTool WPF System.ComponentModel.DesignerProperties.GetIsInDesignMode(UIElement)
  • WinStoreWindows.ApplicationModel.DesignMode.DesignModeEnabledWinPhoneSystem.ComponentModel.DesignerProperties.IsInDesignTool WPF System.ComponentModel.DesignerProperties.GetIsInDesignMode(UIElement)
  • Different parameterMultipleFramesBack button vs hooking up backspace.
  • Different parameterMultipleFramesBack button vs hooking up backspace.
  • Snap View. Privacy Policy
  • WinPhone: Roaming settingsWinRT UI Stack Remote Debugging via Wifi No DWrite or Direct2D on WinPhoneWinStore:WriteableBitmap.Render()RadialBrushes XNA LOB Company Hub APIs (was told “Wait for //build/ conference” this week) Rich Binding support Remote debugging via USB (issue with some wifi networks) See article http://www.itwriting.com/blog/6779-how-to-test-and-debug-an-app-on-surface-rt-in-a-hotel-room.html Build apps using JavaScript (PhoneGap for WP if you really want to)Behaviors

×