NetworkFailed() public method

public NetworkFailed ( NSError error ) : void
error NSError
return void
Ejemplo n.º 1
0
		public override void Execute (FormDialogViewController controller, Element element, Action completed)
		{
			controller.SetValue("temperature", "");
			controller.SetValue("humidity", "");
			controller.SetValue("windspeed", "");
			
			var request = new NSMutableUrlRequest(new NSUrl("http://ws.geonames.org/weatherIcaoJSON?ICAO=KORD"), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 10);
			
			new UrlConnection("weather", request, (result)=>{
				var json = JsonObject.Parse(result);
				var weather = json["weatherObservation"];
				
				controller.SetValue("temperature", weather["temperature"].CleanString()+ " celsius");
				controller.SetValue("humidity", weather["humidity"].CleanString() + "%");
				controller.SetValue("windspeed", weather["windSpeed"].CleanString()+" km/h");
				
				controller.Reload();
				completed();
				
			}, (error)=>{
				controller.NetworkFailed(error);
				completed();
			});
		}