Example #1
0
        public static ILegendCommand CreateExportAsPng(MapPresenter map, VectorLayer layer)
        {
            var result = new LegendCommand()
            {
                PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarImage,
                Layer      = layer,
                ToolTip    = _exportAsBitmapToolTip,
            };

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

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

                    layer.SaveAsPng(fileName, map.CurrentExtent, map.ActualWidth, map.ActualHeight, map.MapScale);
                }
                catch (Exception ex)
                {
                    await map.DialogService.ShowMessageAsync(null, ex.Message, null, null);
                }
            });

            return(result);
        }