summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Pages.Azure/AzureEasyTableSource.cs
blob: 1d5a24f04069a7976d5562cb624ea2ec799de413 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.MobileServices;
using Newtonsoft.Json.Linq;

namespace Xamarin.Forms.Pages.Azure
{
	public class AzureEasyTableSource : AzureSource
	{
		public static readonly BindableProperty TableNameProperty =
			BindableProperty.Create(nameof(TableName), typeof(string), typeof(AzureEasyTableSource), null);

		public string TableName
		{
			get { return (string)GetValue(TableNameProperty); }
			set { SetValue(TableNameProperty, value); }
		}

		public override async Task<JToken> GetJson()
		{
			var mobileServiceClient = new MobileServiceClient(Uri);
			var table = mobileServiceClient.GetTable(TableName);
			return await table.ReadAsync(string.Empty);
		}
	}
}