View difference between Paste ID: 9ZV8nsPK and jrB1EjUA
SHOW: | | - or go back to the newest paste.
1
using System;
2
3
using Android.App;
4
using Android.Content;
5
using Android.Runtime;
6
using Android.Views;
7
using Android.Widget;
8
using Android.OS;
9
using System.Threading.Tasks;
10
using System.Collections.Generic;
11
using Simple.OData.Client;
12
using System.Net;
13
using System.Net.Http;
14
15
namespace ODataTest
16
{
17
	[Activity (Label = "ODataTest", MainLauncher = true, Icon = "@drawable/icon")]
18
	public class MainActivity : Activity
19
	{
20
		HttpClient hc = new HttpClient ();
21
22
		protected override void OnCreate (Bundle bundle)
23
		{
24
			base.OnCreate (bundle);
25
26
			// Set our view from the "main" layout resource
27
			SetContentView (Resource.Layout.Main);
28
			Task<HttpResponseMessage> newTask = GetWebsite ();
29
	                newTask.ConfigureAwait (false);
30
			newTask.Wait ();
31
			var x = newTask.Result;
32
			//WebRequest wr = WebRequest.Create ("www.google.com");
33
			//WebResponse wresp = wr.GetResponse ();
34
		}
35
36
		public async Task<HttpResponseMessage> GetWebsite()
37
		{
38
			var uri = Android.Net.Uri.Parse ("http://www.xamarin.com");
39
			return await hc.GetAsync (uri.ToString());
40
		}
41
	}
42
}