public void HandleException(Exception e, CancellationTokenSource source) { Type exceptionType = e.GetType (); // System.Diagnostics.Debug.WriteLine ("HandleException::{0}", exceptionType); if (exceptionType == typeof(TaskCanceledException)) { TaskCanceledException tce = (TaskCanceledException)e; if (tce.CancellationToken == source.Token) { System.Diagnostics.Debug.WriteLine ("GoogleGeocoderResponse::This is a real cancellation triggered by the caller."); } else { System.Diagnostics.Debug.WriteLine ("GoogleGeocoderResponse::This is a web request time out."); } } else { System.Diagnostics.Debug.WriteLine ("GoogleGeocoderResponse::{0}.", e.Message); source.Cancel (); // throw e; } response = new GoogleGeocoderResponseObj (); response.status = "network_error"; response.results = null; }
public void Serialize(string content) { response = JsonConvert.DeserializeObject<GoogleGeocoderResponseObj> (content); // System.Diagnostics.Debug.WriteLine ("Serialize::" + response.results[0].formatted_address); }