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. 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. 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. 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. 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
14. 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
15. 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
16. Use the Dispatcher to call the UI Thread
However they look different...
5. The Dispatcher
19. 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
20. 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
25. 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
26. 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
27. 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
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's also an XNA version)
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