forked from anaisbetts/ModernHttpClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetHttp.cs
More file actions
33 lines (28 loc) · 705 Bytes
/
NetHttp.cs
File metadata and controls
33 lines (28 loc) · 705 Bytes
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
//
// This file contains the sample code to use System.Net.HttpClient
// on the iPhone to communicate using Apple's CFNetwork API
//
using System;
using System.Threading.Tasks;
using System.Net.Http;
namespace HttpClient.Android
{
public class NetHttp
{
MainActivity ad;
public NetHttp (MainActivity ad)
{
this.ad = ad;
}
public async Task HttpSample (HttpMessageHandler handler = null)
{
this.ad.Busy ();
System.Net.Http.HttpClient client = (handler == null) ?
new System.Net.Http.HttpClient () :
new System.Net.Http.HttpClient (handler);
var stream = await client.GetStreamAsync (MainActivity.WisdomUrl);
this.ad.Done ();
ad.RenderStream (stream);
}
}
}