internal static void Launch(IDesktopWindow desktopWindow, List <IClipboardItem> clipboardItems) { Platform.CheckForNullReference(desktopWindow, "desktopWindow"); Platform.CheckForNullReference(clipboardItems, "clipboardItems"); if (_multipleImageExporter != null) { desktopWindow.ShowMessageBox(SR.MessageImageExportStillRunning, MessageBoxActions.Ok); return; } int numberOfImagesToExport = GetNumberOfImagesToExport(clipboardItems); Platform.CheckPositive(numberOfImagesToExport, "numberOfImagesToExport"); string title = SR.TitleExportImages; if (numberOfImagesToExport == 1) { title = SR.TitleExportSingleImage; } //initialize the component. ImageExportComponent component = new ImageExportComponent(); component.ItemsToExport = clipboardItems; component.NumberOfImagesToExport = numberOfImagesToExport; // give the width and height values from the first image to be exported if (clipboardItems.Count > 0) { object item = clipboardItems[0].Item; if (item is IImageGraphicProvider) { IImageGraphicProvider imageGraphicProvider = (IImageGraphicProvider)item; component.Height = imageGraphicProvider.ImageGraphic.Rows; component.Width = imageGraphicProvider.ImageGraphic.Columns; } else if (item is IDisplaySet) { foreach (IPresentationImage image in ((IDisplaySet)item).PresentationImages) { if (image is IImageGraphicProvider) { IImageGraphicProvider imageGraphicProvider = (IImageGraphicProvider)image; component.Height = imageGraphicProvider.ImageGraphic.Rows; component.Width = imageGraphicProvider.ImageGraphic.Columns; break; } } } } if (ApplicationComponentExitCode.Accepted != LaunchAsDialog(desktopWindow, component, title)) { return; } component.Export(); }
public MultipleImageExporter(ImageExportComponent exportComponent) { _exportComponent = exportComponent; _fileNamingStrategy = new MultipleImageExportFileNamingStrategy(_exportComponent.ExportFilePath); _imagesToDispose = new List <IPresentationImage>(); }
public void Export() { try { List <IClipboardItem> selectedClipboardItems = new List <IClipboardItem>(this.Context.SelectedClipboardItems); ImageExportComponent.Launch(this.Context.DesktopWindow, selectedClipboardItems); } catch (Exception e) { ExceptionHandler.Report(e, SR.MessageExportFailed, Context.DesktopWindow); } }