forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPclExportClient.Android.cs
More file actions
51 lines (42 loc) · 1.58 KB
/
PclExportClient.Android.cs
File metadata and controls
51 lines (42 loc) · 1.58 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//Copyright (c) Service Stack LLC. All Rights Reserved.
//License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
#if ANDROID
using System;
using System.Collections.Specialized;
using System.Threading;
using Android.OS;
using System.Net;
using ServiceStack.Web;
namespace ServiceStack
{
public class AndroidPclExportClient : PclExportClient
{
public static AndroidPclExportClient Provider = new AndroidPclExportClient();
public override INameValueCollection NewNameValueCollection()
{
return new NameValueCollectionWrapper(new NameValueCollection());
}
public override INameValueCollection ParseQueryString(string query)
{
return ServiceStack.Pcl.HttpUtility.ParseQueryString(query).InWrapper();
}
public Handler UiHandler;
public static PclExportClient Configure()
{
Configure(Provider ?? (Provider = new AndroidPclExportClient()));
AndroidPclExport.Configure();
Provider.UiHandler = new Handler(Looper.MainLooper);
return Provider;
}
public override ITimer CreateTimer(TimerCallback cb, TimeSpan timeOut, object state)
{
return new AsyncTimer(new
System.Threading.Timer(s => cb(s), state, (int)timeOut.TotalMilliseconds, Timeout.Infinite));
}
public override Exception CreateTimeoutException(Exception ex, string errorMsg)
{
return new WebException("The request timed out", ex, WebExceptionStatus.Timeout, null);
}
}
}
#endif