public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { string tmpFile = captureDetails.Filename; Size imageSize = Size.Empty; if (tmpFile == null || surface.Modified) { using (Image image = surface.GetImageForExport()) { tmpFile = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors); imageSize = image.Size; } } if (presentationName != null) { PowerpointExporter.ExportToPresentation(presentationName, tmpFile, imageSize, captureDetails.Title); } else { if (!manuallyInitiated) { List <string> presentations = PowerpointExporter.GetPowerpointPresentations(); if (presentations != null && presentations.Count > 0) { List <IDestination> destinations = new List <IDestination>(); destinations.Add(new PowerpointDestination()); foreach (string presentation in presentations) { destinations.Add(new PowerpointDestination(presentation)); } ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations); PickerDestination.ShowMenuAtCursor(menu); return(false); } } PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title); } surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); surface.Modified = false; return(true); }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { string tmpFile = captureDetails.Filename; if (tmpFile == null || surface.Modified) { using (Image image = surface.GetImageForExport()) { tmpFile = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors); } } if (documentCaption != null) { WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile); } else { if (!manuallyInitiated) { List <string> documents = WordExporter.GetWordDocuments(); if (documents != null && documents.Count > 0) { List <IDestination> destinations = new List <IDestination>(); destinations.Add(new WordDestination()); foreach (string document in documents) { destinations.Add(new WordDestination(document)); } ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations); PickerDestination.ShowMenuAtCursor(menu); return(false); } } WordExporter.InsertIntoNewDocument(tmpFile); } surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); surface.Modified = false; return(true); }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { if (!isOutlookUsed) { using (Image image = surface.GetImageForExport()) { MapiMailMessage.SendImage(image, captureDetails); surface.Modified = false; surface.SendMessageEvent(this, SurfaceMessageTyp.Info, "Exported to " + mapiClient); } return(true); } // Outlook logic string tmpFile = captureDetails.Filename; if (tmpFile == null || surface.Modified) { using (Image image = surface.GetImageForExport()) { tmpFile = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors); } } else { LOG.InfoFormat("Using already available file: {0}", tmpFile); } // Create a attachment name for the image string attachmentName = captureDetails.Title; if (!string.IsNullOrEmpty(attachmentName)) { attachmentName = attachmentName.Trim(); } // Set default if non is set if (string.IsNullOrEmpty(attachmentName)) { attachmentName = "Greenshot Capture"; } // Make sure it's "clean" so it doesn't corrupt the header attachmentName = Regex.Replace(attachmentName, @"[^\x20\d\w]", ""); if (outlookInspectorCaption != null) { OutlookEmailExporter.ExportToInspector(outlookInspectorCaption, tmpFile, attachmentName); } else { if (!manuallyInitiated) { Dictionary <string, OlObjectClass> inspectorCaptions = OutlookEmailExporter.RetrievePossibleTargets(conf.OutlookAllowExportInMeetings); if (inspectorCaptions != null && inspectorCaptions.Count > 0) { List <IDestination> destinations = new List <IDestination>(); destinations.Add(new EmailDestination()); foreach (string inspectorCaption in inspectorCaptions.Keys) { destinations.Add(new EmailDestination(inspectorCaption, inspectorCaptions[inspectorCaption])); } ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations); PickerDestination.ShowMenuAtCursor(menu); return(false); } } OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, captureDetails.Title, attachmentName); } surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); surface.Modified = false; // Don't know how to handle a cancel in the email return(true); }