Mobile Development with Xamarin Mark Allan Ranyart Systems @MarkXA
Modern DNN SPA modules – UI talking to web services MVC APIs now a truly first class citizen Since your module(s) now work through an API, building equivalent apps is an obvious next step
Modern DNN DNN API SPA module App DB Module API Traditional DNN module DNN API DB DNN DNN Then Now
App per platform  Build a native iOS app • XCode, Objective-C / Swift, Storyboards / NIBs, Cocoa  Build a native Android app • Eclipse / Android Studio, Java, XML layouts  Build a native Windows app • Visual Studio, C#, XAML  OS X, Apple Watch, Google Wear, etc …
App per platform Android app Windows appiOS app
Write once, run anywhere Build app using HTML / CSS / JS Framework provides controls and access to platform features • Cordova, Ionic, Kendo, Sencha App emulates native UI on supported platforms
Write once, run anywhere HTML5
Xamarin Use preferred language • C# / F# Write core logic once • Network calls, data model, business logic Per-platform native UI Native API access in preferred language
Xamarin C# / F# shared project Android UI Windows UIiOS UI iOS C#/ F# platform code Android C# / F# platform code Windows C# / F# platform code
Windows APIs
iOS APIs
Android APIs
APIs A native implementation of the .NET framework is provided for each platform Platform APIs are exposed to C# / F# via .NET wrappers – 100% coverage Anything you can do in Objective-C, Swift or Java can be done in C# / F#
Performance iOS: Ahead-Of-Time compilation to ARM Android: Just-In-Time bytecode compilation Performance roughly equal to native • Using .NET and other cross-platform libraries may be slower than binding native libraries
Tools  Visual Studio • Run on Windows • Build and deploy to Android and Windows directly • Build and deploy to iOS and Mac via build host running on OS X machine  Xamarin Studio • Run on Windows or Mac • Extra support for iOS / Android apps • No support for iOS on Windows, or Windows apps on either OS
Code
UI iOS: Storyboards / NIBs (or raw code) Android: XML layouts (or raw code) Windows Phone: XAML (or raw code) Platform-specific pages, controls, layouts
Xamarin.Forms Use preferred language • C# / F# Write core logic once • Network calls, data model, business logic Single XAML UI generates native controls Native API access in preferred language
Xamarin.Forms C# / F# Portable Class Library iOS C# / F# platform code Android C# / F# platform code Windows C# / F# platform code XAML UI
Xamarin.Forms controls  Pages • ContentPage • NavigationPage • TabbedPage • MasterDetailPage • CarouselPage  Layouts • StackLayout • ScrollView • RelativeLayout • AbsoluteLayout • Grid  Controls • ActivityIndicator • BoxView • Button • Cell • DatePicker • Editor • Entry • Image • Label • ListView • OpenGLView • Picker • ProgressBar • SearchBar • Slider • Stepper • Switch • TableView • TimePicker • WebView
XAML example <ListView ItemsSource="{Binding MyList}" IsGroupingEnabled="true" GroupDisplayBinding="{Binding LongTitle}" GroupShortNameBinding="{Binding Title}"> <ListView.ItemTemplate> <DataTemplate> <TextCell Text="{Binding Name}" Detail="{Binding Description}" /> </DataTemplate> </ListView.ItemTemplate> </ListView>
XAML output
Control extensibility iOS renderer Android renderer Windows renderer XAML custom control
Demo
Questions?

DNN Connect - Mobile Development With Xamarin

  • 1.
    Mobile Development with Xamarin MarkAllan Ranyart Systems @MarkXA
  • 2.
    Modern DNN SPA modules– UI talking to web services MVC APIs now a truly first class citizen Since your module(s) now work through an API, building equivalent apps is an obvious next step
  • 3.
    Modern DNN DNN API SPAmodule App DB Module API Traditional DNN module DNN API DB DNN DNN Then Now
  • 4.
    App per platform Build a native iOS app • XCode, Objective-C / Swift, Storyboards / NIBs, Cocoa  Build a native Android app • Eclipse / Android Studio, Java, XML layouts  Build a native Windows app • Visual Studio, C#, XAML  OS X, Apple Watch, Google Wear, etc …
  • 5.
    App per platform Androidapp Windows appiOS app
  • 6.
    Write once, runanywhere Build app using HTML / CSS / JS Framework provides controls and access to platform features • Cordova, Ionic, Kendo, Sencha App emulates native UI on supported platforms
  • 7.
    Write once, runanywhere HTML5
  • 8.
    Xamarin Use preferred language •C# / F# Write core logic once • Network calls, data model, business logic Per-platform native UI Native API access in preferred language
  • 9.
    Xamarin C# / F#shared project Android UI Windows UIiOS UI iOS C#/ F# platform code Android C# / F# platform code Windows C# / F# platform code
  • 10.
  • 11.
  • 12.
  • 13.
    APIs A native implementationof the .NET framework is provided for each platform Platform APIs are exposed to C# / F# via .NET wrappers – 100% coverage Anything you can do in Objective-C, Swift or Java can be done in C# / F#
  • 14.
    Performance iOS: Ahead-Of-Time compilationto ARM Android: Just-In-Time bytecode compilation Performance roughly equal to native • Using .NET and other cross-platform libraries may be slower than binding native libraries
  • 15.
    Tools  Visual Studio •Run on Windows • Build and deploy to Android and Windows directly • Build and deploy to iOS and Mac via build host running on OS X machine  Xamarin Studio • Run on Windows or Mac • Extra support for iOS / Android apps • No support for iOS on Windows, or Windows apps on either OS
  • 16.
  • 17.
    UI iOS: Storyboards /NIBs (or raw code) Android: XML layouts (or raw code) Windows Phone: XAML (or raw code) Platform-specific pages, controls, layouts
  • 18.
    Xamarin.Forms Use preferred language •C# / F# Write core logic once • Network calls, data model, business logic Single XAML UI generates native controls Native API access in preferred language
  • 19.
    Xamarin.Forms C# / F#Portable Class Library iOS C# / F# platform code Android C# / F# platform code Windows C# / F# platform code XAML UI
  • 20.
    Xamarin.Forms controls  Pages •ContentPage • NavigationPage • TabbedPage • MasterDetailPage • CarouselPage  Layouts • StackLayout • ScrollView • RelativeLayout • AbsoluteLayout • Grid  Controls • ActivityIndicator • BoxView • Button • Cell • DatePicker • Editor • Entry • Image • Label • ListView • OpenGLView • Picker • ProgressBar • SearchBar • Slider • Stepper • Switch • TableView • TimePicker • WebView
  • 21.
    XAML example <ListView ItemsSource="{Binding MyList}" IsGroupingEnabled="true" GroupDisplayBinding="{BindingLongTitle}" GroupShortNameBinding="{Binding Title}"> <ListView.ItemTemplate> <DataTemplate> <TextCell Text="{Binding Name}" Detail="{Binding Description}" /> </DataTemplate> </ListView.ItemTemplate> </ListView>
  • 22.
  • 23.
    Control extensibility iOS rendererAndroid renderer Windows renderer XAML custom control
  • 24.
  • 25.

Editor's Notes

  • #17 Walkthrough of contents of Xamarin’s Tasky sample solution (http://developer.xamarin.com/samples/mobile/Tasky/)
  • #25 https://github.com/MarkXA/DNNConnect-Xamarin