protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); MapiMailMessage.SendImage(surface, captureDetails); exportInformation.ExportMade = true; ProcessExport(exportInformation, surface); return(exportInformation); }
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); }