MonoMobile.Forms.FormDialogViewController.NetworkFailed C# (CSharp) Method

NetworkFailed() public method

public NetworkFailed ( NSError error ) : void
error NSError
return void
		public virtual void NetworkFailed(NSError error){
			Loading = false;
			InvokeOnMainThread(()=>{
				using (var popup = new UIAlertView("Error", error.LocalizedDescription, null, "OK")){
					popup.Show();
				}
			});
		}
		

Usage Example

		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();
			});
		}