summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Pages/JsonSource.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Pages/JsonSource.cs')
-rw-r--r--Xamarin.Forms.Pages/JsonSource.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/Xamarin.Forms.Pages/JsonSource.cs b/Xamarin.Forms.Pages/JsonSource.cs
new file mode 100644
index 00000000..46c0a95d
--- /dev/null
+++ b/Xamarin.Forms.Pages/JsonSource.cs
@@ -0,0 +1,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);
+ }
+ }
+} \ No newline at end of file