End to End Azure and Xamarin.Forms
Total Page:16
File Type:pdf, Size:1020Kb
End-to-End Native Mobile Apps with C# and Xamarin James Montemagno Developer Evangelist, Xamarin [email protected] motzcod.es @JamesMontemagno DESIGN – DEVELOP - INTEGRATE TEST MONITOR LEARN iOS C# UI Android C# UI Windows C# UI Shared C# Mobile Shared C# codebase • 100% native API access • High performance Microsoft.Phone Microsoft.Networking Windows.Storage Windows.Foundation Microsoft.Devices System.Net System System.IO System.Linq System.Xml System.Data System.Windows System.Numerics System.Core System.ServiceModel MapKit UIKit iBeacon CoreGraphics CoreMotion System.Net System System.IO System.Linq System.Xml System.Data System.Windows System.Numerics System.Core System.ServiceModel Text-to-speech ActionBar Printing Framework Renderscript NFC System.Net System System.IO System.Linq System.Xml System.Data System.Windows System.Numerics System.Core System.ServiceModel .NET IL + JIT Compile C# and Link .APK Runs Natively Bindings Xamarin.iOS does full Ahead Of Time Xamarin.Android takes advantage of (AOT) compilation to produce an ARM Just In Time (JIT) compilation on the binary for Apple’s App Store. Android device. • • • • • ✓Always Up-to-Date • • • • • • iOS C# UI Android C# UI Windows C# UI Shared UI Code Shared C# Backend Shared C# Backend Traditional Xamarin With Xamarin.Forms: Approach More code-sharing, all native ✓ 40+ Pages, layouts, and controls (Build from code behind or XAML) Shared UI Code ✓ Two-way data binding ✓ Navigation Shared C# Backend ✓ Animation API ✓ Dependency Service ✓ Messaging Center Pages Content MasterDetail Navigation Tabbed Carousel Layouts Stack Absolute Relative Grid ContentView ScrollView Frame ActivityIndicator BoxView Button DatePicker Editor Entry Image Label ListView Map OpenGLView Picker ProgressBar SearchBar Slider Stepper Tab leView TimePicker WebView EntryCell ImageCell SwitchCell TextCell ViewCell Xamarin.Forms Ecosystem Android Clicked Button Text TouchUpInside Xamarin.Forms iOS Text Button UIButton Clicked Text Windows Clicked Button Content Windows Xamarin.Forms StackPanel StackLayout TextBox Entry ListBox ListView CheckBox Switch ProgressBar ActivityIndicator Grid Grid Label Label Button Button Image Image Date/TimePicker Date/TimePicker Windows Xamarin.Forms DataContext BindingContext {Binding Property} {Binding Property} ItemsSource ItemsSource ItemTemplate ItemTemplate DataTemplate DataTemplate <?xml version="1.0" encoding="UTF-8"?> <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyApp.MainPage"> <TabbedPage.Children> <ContentPage Title="ProFile" Icon="ProFile.png"> <StackLayout Spacing="20" Padding="20" VerticalOptions="Center"> <Entry Placeholder="Username" Text="{Binding Username}"/> <Entry Placeholder="Password" Text="{Binding Password}" IsPassword="true"/> <Button Text="Login" TextColor="White" BackgroundColor="#77D065" Command="{Binding LoginCommand}"/> </StackLayout> </ContentPage> <ContentPage Title="Settings" Icon="Settings.png"> <!-- Settings --> </ContentPage> </TabbedPage.Children> Azure Mobile Apps Offline Sync Backend code SQL Tables Mongo O365 API Apps Facebook Twitter Microsoft Google Azure Active Directory REST API REST Offline sync iOS Android Windows Kindle In-App OSX Chrome Create a MobileService MobileService = new MobileServiceClient( "https://myapp.azurewebsites.net", "https://mygateway.azurewebsites.net", "mykey goes here"); Create Tables IMobileServiceSyncTable<Store> table; public async Task Init() { const string path = "syncstore.db"; var db = new MobileServiceSQLiteStore(path); db.DefineTable<Store>(); var handler = new MobileServiceSyncHandler(); await MobileService.SyncContext.InitializeAsync(db, h); table = MobileService.GetSyncTable<Store>(); } Get and Modify Data public async Task<IEnumerable<Store>> GetStoresAsync() { await table.PullAsync("allStores", table.CreateQuery()); return await table.ToEnumerableAsync(); } public async Task<Store> AddStoreAsync (Store store) { await table.InsertAsync (store); await table.PullAsync("allStores", table.CreateQuery()); await MobileService.SyncContext.PushAsync(); return store; } Ta p Scroll Swipe Pinch Multi Finger Text Entry Rotation GPS xamarin.com/testcloud xamarin.com/insights Supports ✓ Xamarin.iOS ✓ Xamarin.Android ✓ Xamarin.Mac ✓ Windows Phone ✓ Windows Store ✓ Windows Desktop Simple integrations into popular services for mission critical notifications. Get Started Today xamarin.com Unrivaled Mobile Live unlimited mobile development training from Development mobile experts, in your time-zone, on your Training schedule, and as often as you'd like. Free trial - xamarin.com/university Thank you. Please use Event Board to fill out a session evaluation. James Montemagno Developer Evangelist, Xamarin [email protected] motzcod.es @JamesMontemagno.