/// <summary> /// Prompt user for file path and save plot as image to that path. /// </summary> private void SaveAsImageImplementation() { var filePath = this.dialogService.SaveFile(".png", @"Png Files (*.png)|*.png"); if (string.IsNullOrWhiteSpace(filePath)) { return; } try { var directory = Path.GetDirectoryName(filePath); if (directory == null || !Directory.Exists(directory)) { throw new FormatException( string.Format("Cannot save image due to invalid file name: {0}", filePath)); } DynamicResolutionPngExporter.Export( this.PlotModel, filePath, (int)this.PlotModel.Width, (int)this.PlotModel.Height, OxyColors.White, IcParameters.Instance.ExportImageDpi); } catch (Exception e) { this.dialogService.ExceptionAlert(e); } }
public void Export(PrSm id, string outputPath) { var plotModel = GetPlotModel(id); DynamicResolutionPngExporter.Export( plotModel, outputPath, 1280, 1024, OxyColors.White, dpi); }
public async Task ExportAsync(PrSm id, string outputPath) { var plotModel = await GetPlotModelAsync(id); DynamicResolutionPngExporter.Export( plotModel, outputPath, 1280, 1024, OxyColors.White, dpi); }