public static async void UpdateVisWithGridEvent(this MapView map, string url, Action<string> error = null)
        {
            await ThreadPool.RunAsync(delegate
            {
                map.Layers.Clear();

                // Create overlay layer for Popups
                Projection projection = map.Options.BaseProjection;
                LocalVectorDataSource source = new LocalVectorDataSource(projection);
                VectorLayer layer = new VectorLayer(source);

                // Create VIS loader
                CartoVisLoader loader = new CartoVisLoader();
                loader.DefaultVectorLayerMode = true;
                CartoVisBuilderWithGridEvent builder = new CartoVisBuilderWithGridEvent(map, layer);

                try
                {
                    loader.LoadVis(builder, url);
                }
                catch (Exception e)
                {
                    if (error != null)
                    {
                        error(e.Message);
                    }
                }

                map.Layers.Add(layer);
            });
        }
示例#2
0
        public static async void UpdateVisWithGridEvent(this MapView map, string url, Action <string> error = null)
        {
            await ThreadPool.RunAsync(delegate
            {
                map.Layers.Clear();

                // Create overlay layer for Popups
                Projection projection        = map.Options.BaseProjection;
                LocalVectorDataSource source = new LocalVectorDataSource(projection);
                VectorLayer layer            = new VectorLayer(source);

                // Create VIS loader
                CartoVisLoader loader                = new CartoVisLoader();
                loader.DefaultVectorLayerMode        = true;
                CartoVisBuilderWithGridEvent builder = new CartoVisBuilderWithGridEvent(map, layer);

                try
                {
                    loader.LoadVis(builder, url);
                }
                catch (Exception e)
                {
                    if (error != null)
                    {
                        error(e.Message);
                    }
                }

                map.Layers.Add(layer);
            });
        }