void UpdateVis(string url) { InvokeInBackground(delegate { MapView.Layers.Clear(); // Create VIS loader CartoVisLoader loader = new CartoVisLoader(); loader.DefaultVectorLayerMode = true; BasicCartoVisBuilder builder = new BasicCartoVisBuilder(MapView); try { loader.LoadVis(builder, url); } catch (Exception e) { Alert(e.Message); } MapPos tallinn = new MapPos(24.646469, 59.426939); MapView.AddMarkerToPosition(tallinn); }); }
public static async void UpdateVis(this MapView map, string url, Action<string> error = null) { await ThreadPool.RunAsync(delegate { map.Layers.Clear(); // Create VIS loader CartoVisLoader loader = new CartoVisLoader(); loader.DefaultVectorLayerMode = true; BasicCartoVisBuilder builder = new BasicCartoVisBuilder(map); try { loader.LoadVis(builder, url); } catch (Exception e) { if (error != null) { error(e.Message); } } }); }