示例#1
0
        public static ILegendCommand CreateExportAsShapefile(MapPresenter map, VectorLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarDownload,
                Layer      = layer,
                ToolTip    = _exportAsShapefileToolTip,
            };

            result.Command = new RelayCommand(async param =>
            {
                try
                {
                    var fileName = await map.DialogService.ShowSaveFileDialogAsync("*.shp|*.shp", null, layer.LayerName);

                    if (string.IsNullOrWhiteSpace(fileName))
                    {
                        return;
                    }

                    layer.ExportAsShapefile(fileName);
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }