Skip to content

Instantly share code, notes, and snippets.

@hminaya
Last active May 5, 2017 00:23
Show Gist options
  • Save hminaya/043cc20679abfd5e0e53273b59dfca91 to your computer and use it in GitHub Desktop.
Save hminaya/043cc20679abfd5e0e53273b59dfca91 to your computer and use it in GitHub Desktop.
Requirements

Diplomado Xamarin - Day3

Lab Exercise

Azure - Backed

Azure Mobile Service

  • Go to azure.com
  • New > Web + Mobile > Mobile App
  • Fill in all of the information and confirm
  • Wait for azure to finish (it takes a few seconds)

Easy Tables - Setup

  • App Services > [The name of your service] > Mobile > Easy Tables
  • Click on "Need to configure Easy Tables/Easy APIs - Click here to continue"
  • Follow the wizards to create a DB, then enable EasyTables

Easy Tables - Schema

  • Create a table called customers (lower case)
  • Add a field called name (lower case)
  • Add a field called email (lower case)

Test

  • You should be able to call the rest API and get a result (empty)
  • https://[your url].azurewebsites.net/tables/customers?ZUMO-API-VERSION=2.0.0

Mobile App

Github

  • Clone (or download) the repository from https://github.com/hminaya/DiplomadoMSDay3
  • Open with Xamarin Studio on the MAC or Visual Studio on Windows
  • Right click on the Solution name, Clean, Restore Nuget Packages, Rebuild (make sure you are connected to the internet)
  • Run the app on a Simulator or Device
  • It should display the Customer Dashboard with no data

Customer.cs

  • Make sure the table name matches what is in the JsonObject title property, if not change it
  • Make sure the column names match the JsonProperty tags, if not, change them

AzureService.cs

  • Change the MobileUrl property to point to your backend
  • Create a method to insert a Customer
  • Create a method to get a list of Customers

MainPageViewModel.cs

  • Inject AzureService into the MainPageViewModel constructor
  • Wire up the OnSave() and OnSync() methods to call the AzureService methods
  • Add a Dialog Confirmation to notify when Sync has been completed (using PageDialogService)

Make sure

  • When you add a new customer, the list gets refreshed
  • When you click Sync, the list gets refreshed
  • When you open the App, the list loads the current customers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment