summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Pages/JsonSource.cs
blob: 46c0a95dfc612f824784be683f64a536af00e876 (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
using System;
using System.Threading.Tasks;

namespace Xamarin.Forms.Pages
{
	public abstract class JsonSource : Element
	{
		public static JsonSource FromString(string json)
		{
			return new StringJsonSource { Json = json };
		}

		public static JsonSource FromUri(Uri uri)
		{
			return new UriJsonSource { Uri = uri };
		}

		public abstract Task<string> GetJson();

		public static implicit operator JsonSource(string json)
		{
			return FromString(json);
		}
	}
}