public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { base.SetDefaults(surface); ExportInformation exportInformation = new ExportInformation(Designation, Description); if (page == null) { try { exportInformation.ExportMade = OneNoteExporter.ExportToNewPage(surface); } catch (Exception ex) { exportInformation.ErrorMessage = ex.Message; LOG.Error(ex); } } else { try { exportInformation.ExportMade = OneNoteExporter.ExportToPage(surface, page); } catch (Exception ex) { exportInformation.ErrorMessage = ex.Message; LOG.Error(ex); } } return(exportInformation); }
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); if (_page == null) { try { exportInformation.ExportMade = OneNoteExporter.ExportToNewPage(surface); } catch (Exception ex) { exportInformation.ErrorMessage = ex.Message; Log.Error().WriteLine(ex); } } else { try { exportInformation.ExportMade = OneNoteExporter.ExportToPage(surface, _page); } catch (Exception ex) { exportInformation.ErrorMessage = ex.Message; Log.Error().WriteLine(ex); } } return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); string tmpFile = captureDetails.Filename; if (tmpFile == null || surface.Modified || !Regex.IsMatch(tmpFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$")) { tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings().PreventGreenshotFormat()); } if (documentCaption != null) { try { WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile); exportInformation.ExportMade = true; } catch (Exception) { try { WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile); exportInformation.ExportMade = true; } catch (Exception ex) { LOG.Error(ex); // TODO: Change to general logic in ProcessExport surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description)); } } } 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)); } // Return the ExportInformation from the picker without processing, as this indirectly comes from us self return(ShowPickerMenu(false, surface, captureDetails, destinations)); } } try { WordExporter.InsertIntoNewDocument(tmpFile, null, null); exportInformation.ExportMade = true; } catch (Exception) { // Retry once, just in case try { WordExporter.InsertIntoNewDocument(tmpFile, null, null); exportInformation.ExportMade = true; } catch (Exception ex) { LOG.Error(ex); // TODO: Change to general logic in ProcessExport surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description)); } } } ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { base.SetDefaults(surface); ExportInformation exportInformation = new ExportInformation(Designation, Description); bool createdFile = false; string imageFile = captureDetails.Filename; if (imageFile == null || surface.Modified || !Regex.IsMatch(imageFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$")) { imageFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings().PreventGreenshotFormat()); createdFile = true; } if (_workbookName != null) { ExcelExporter.InsertIntoExistingWorkbook(_workbookName, imageFile, surface.Image.Size); } else { ExcelExporter.InsertIntoNewWorkbook(imageFile, surface.Image.Size); } exportInformation.ExportMade = true; ProcessExport(exportInformation, surface); // Cleanup imageFile if we created it here, so less tmp-files are generated and left if (createdFile) { ImageOutput.DeleteNamedTmpFile(imageFile); } return(exportInformation); }
public void Upload(ICaptureDetails captureDetails, ISurface surface, ExportInformation exportInformation) { SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(config.UploadFormat, config.UploadJpegQuality, false); try { string flickrUrl = null; new PleaseWaitForm().ShowAndWait("Flickr plug-in", Language.GetString("flickr", LangKey.communication_wait), delegate() { string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails)); flickrUrl = FlickrUtils.UploadToFlickr(surface, outputSettings, captureDetails.Title, filename); } ); if (flickrUrl == null) { exportInformation.ExportMade = false; return; } exportInformation.ExportMade = true; exportInformation.Uri = flickrUrl; if (config.AfterUploadLinkToClipBoard) { ClipboardHelper.SetClipboardData(flickrUrl); } } catch (Exception e) { MessageBox.Show(Language.GetString("flickr", LangKey.upload_failure) + " " + e.Message); } }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(Designation, Description); // Make sure we collect the garbage before opening the screenshot GC.Collect(); GC.WaitForPendingFinalizers(); bool modified = surface.Modified; if (editor == null) { if (editorConfiguration.ReuseEditor) { foreach (IImageEditor openedEditor in ImageEditorForm.Editors) { if (!openedEditor.Surface.Modified) { openedEditor.Surface = surface; exportInformation.ExportMade = true; break; } } } if (!exportInformation.ExportMade) { try { ImageEditorForm editorForm = new ImageEditorForm(surface, !surface.Modified); // Output made?? if (!string.IsNullOrEmpty(captureDetails.Filename)) { editorForm.SetImagePath(captureDetails.Filename); } editorForm.Show(); editorForm.Activate(); LOG.Debug("Finished opening Editor"); exportInformation.ExportMade = true; } catch (Exception e) { LOG.Error(e); exportInformation.ErrorMessage = e.Message; } } } else { try { using (Image image = surface.GetImageForExport()) { editor.Surface.AddImageContainer(image, 10, 10); } exportInformation.ExportMade = true; } catch (Exception e) { LOG.Error(e); exportInformation.ErrorMessage = e.Message; } } ProcessExport(exportInformation, surface); // Workaround for the modified flag when using the editor. surface.Modified = modified; return(exportInformation); }
/// <summary> /// A small helper method to perform some default destination actions, like inform the surface of the export /// </summary> /// <param name="exportInformation"></param> /// <param name="surface"></param> public void ProcessExport(ExportInformation exportInformation, ISurface surface) { if (exportInformation != null && exportInformation.ExportMade) { if (!string.IsNullOrEmpty(exportInformation.Uri)) { surface.UploadUrl = exportInformation.Uri; surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUri, Language.GetFormattedString("exported_to", exportInformation.DestinationDescription)); } else if (!string.IsNullOrEmpty(exportInformation.Filepath)) { surface.LastSaveFullPath = exportInformation.Filepath; surface.SendMessageEvent(this, SurfaceMessageTyp.FileSaved, Language.GetFormattedString("exported_to", exportInformation.DestinationDescription)); } else { surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString("exported_to", exportInformation.DestinationDescription)); } surface.Modified = false; } else if (!string.IsNullOrEmpty(exportInformation?.ErrorMessage)) { surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("exported_to_error", exportInformation.DestinationDescription) + " " + exportInformation.ErrorMessage); } }
/// <summary> /// Export the capture to outlook /// </summary> /// <param name="manuallyInitiated"></param> /// <param name="surface"></param> /// <param name="captureDetails"></param> /// <returns></returns> public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); // Outlook logic string tmpFile = captureDetails.Filename; if (tmpFile == null || surface.Modified || !Regex.IsMatch(tmpFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$")) { tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings().PreventGreenshotFormat()); } 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); exportInformation.ExportMade = true; } else { if (!manuallyInitiated) { IDictionary <string, OlObjectClass> inspectorCaptions = OutlookEmailExporter.RetrievePossibleTargets(); if (inspectorCaptions != null && inspectorCaptions.Count > 0) { List <IDestination> destinations = new List <IDestination>(); destinations.Add(new OutlookDestination()); foreach (string inspectorCaption in inspectorCaptions.Keys) { destinations.Add(new OutlookDestination(inspectorCaption, inspectorCaptions[inspectorCaption])); } // Return the ExportInformation from the picker without processing, as this indirectly comes from us self return(ShowPickerMenu(false, surface, captureDetails, destinations)); } } else { exportInformation.ExportMade = OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, FilenameHelper.FillPattern(conf.EmailSubjectPattern, captureDetails, false), attachmentName, conf.EmailTo, conf.EmailCC, conf.EmailBCC, null); } } ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); exportInformation.ExportMade = plugin.DoOCR(surface) != null; return(exportInformation); }
/// <summary> /// Export the capture to the printer /// </summary> /// <param name="manuallyInitiated"></param> /// <param name="surface"></param> /// <param name="captureDetails"></param> /// <returns>ExportInformation</returns> public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); PrinterSettings printerSettings = null; if (!string.IsNullOrEmpty(printerName)) { using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) { printerSettings = printHelper.PrintTo(printerName); } } else if (!manuallyInitiated) { PrinterSettings settings = new PrinterSettings(); using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) { printerSettings = printHelper.PrintTo(settings.PrinterName); } } else { using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) { printerSettings = printHelper.PrintWithDialog(); } } if (printerSettings != null) { exportInformation.ExportMade = true; } ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(Designation, Description); bool outputMade; bool overwrite; string fullPath; // Get output settings from the configuration SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(); if (captureDetails != null && captureDetails.Filename != null) { // As we save a pre-selected file, allow to overwrite. overwrite = true; LOG.InfoFormat("Using previous filename"); fullPath = captureDetails.Filename; outputSettings.Format = ImageOutput.FormatForFilename(fullPath); } else { fullPath = CreateNewFilename(captureDetails); // As we generate a file, the configuration tells us if we allow to overwrite overwrite = conf.OutputFileAllowOverwrite; } if (conf.OutputFilePromptQuality) { QualityDialog qualityDialog = new QualityDialog(outputSettings); qualityDialog.ShowDialog(); } // Catching any exception to prevent that the user can't write in the directory. // This is done for e.g. bugs #2974608, #2963943, #2816163, #2795317, #2789218, #3004642 try { ImageOutput.Save(surface, fullPath, overwrite, outputSettings, conf.OutputFileCopyPathToClipboard); outputMade = true; } catch (ArgumentException ex1) { // Our generated filename exists, display 'save-as' LOG.InfoFormat("Not overwriting: {0}", ex1.Message); // when we don't allow to overwrite present a new SaveWithDialog fullPath = ImageOutput.SaveWithDialog(surface, captureDetails); outputMade = (fullPath != null); } catch (Exception ex2) { LOG.Error("Error saving screenshot!", ex2); // Show the problem MessageBox.Show(Language.GetString(LangKey.error_save), Language.GetString(LangKey.error)); // when save failed we present a SaveWithDialog fullPath = ImageOutput.SaveWithDialog(surface, captureDetails); outputMade = (fullPath != null); } // Don't overwrite filename if no output is made if (outputMade) { exportInformation.ExportMade = outputMade; exportInformation.Filepath = fullPath; captureDetails.Filename = fullPath; conf.OutputFileAsFullpath = fullPath; } ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); plugin.Upload(captureDetails, surface, exportInformation); ProcessExport(exportInformation, surface); return(exportInformation); }
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 ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(Designation, Description) { ExportMade = _plugin.DoOcr(surface) != null }; return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); // force password check to take place before the pages load if (!ConfluencePlugin.ConfluenceConnector.isLoggedIn) { return(exportInformation); } Page selectedPage = page; bool openPage = (page == null) && config.OpenPageAfterUpload; string filename = FilenameHelper.GetFilenameWithoutExtensionFromPattern(coreConfig.OutputFileFilenamePattern, captureDetails); if (selectedPage == null) { ConfluenceUpload confluenceUpload = new ConfluenceUpload(filename); Nullable <bool> dialogResult = confluenceUpload.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value) { selectedPage = confluenceUpload.SelectedPage; if (confluenceUpload.isOpenPageSelected) { openPage = false; } filename = confluenceUpload.Filename; } } string extension = "." + config.UploadFormat; if (!filename.ToLower().EndsWith(extension)) { filename = filename + extension; } if (selectedPage != null) { string errorMessage; bool uploaded = upload(surface, selectedPage, filename, out errorMessage); if (uploaded) { if (openPage) { try { Process.Start(selectedPage.Url); } catch { } } exportInformation.ExportMade = true; exportInformation.Uri = selectedPage.Url; } else { exportInformation.ErrorMessage = errorMessage; } } ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); string uploadURL = null; exportInformation.ExportMade = plugin.Upload(captureDetails, surface, out uploadURL); exportInformation.Uri = uploadURL; ProcessExport(exportInformation, surface); return(exportInformation); }
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); try { using (var clipboardAccessToken = ClipboardNative.Access()) { clipboardAccessToken.ClearContents(); // TODO: Test if this works if (!string.IsNullOrEmpty(surface.LastSaveFullPath)) { clipboardAccessToken.SetAsUnicodeString(surface.LastSaveFullPath); } foreach (var clipboardFormat in CoreConfiguration.ClipboardFormats) { switch (clipboardFormat) { case ClipboardFormats.DIB: clipboardAccessToken.SetAsDeviceIndependendBitmap(surface); break; case ClipboardFormats.DIBV5: clipboardAccessToken.SetAsFormat17(surface); break; case ClipboardFormats.PNG: clipboardAccessToken.SetAsBitmap(surface, new SurfaceOutputSettings(OutputFormats.png)); break; case ClipboardFormats.BITMAP: clipboardAccessToken.SetAsBitmap(surface, new SurfaceOutputSettings(OutputFormats.bmp)); break; case ClipboardFormats.HTML: clipboardAccessToken.SetAsHtml(surface); break; case ClipboardFormats.HTMLDATAURL: clipboardAccessToken.SetAsEmbeddedHtml(surface); break; } } } exportInformation.ExportMade = true; } catch (Exception) { // TODO: Change to general logic in ProcessExport surface.SendMessageEvent(this, SurfaceMessageTyp.Error, "Error"); //GreenshotLanguage.editorclipboardfailed); } ProcessExport(exportInformation, surface); return(exportInformation); }
/// <summary> /// Share the screenshot with a windows app /// </summary> /// <param name="manuallyInitiated"></param> /// <param name="surface"></param> /// <param name="captureDetails"></param> /// <returns>ExportInformation</returns> protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); try { var triggerWindow = new Window { WindowState = WindowState.Normal, WindowStartupLocation = WindowStartupLocation.CenterScreen, Width = 400, Height = 400 }; triggerWindow.Show(); var shareInfo = new ShareInfo(); // This is a bad trick, but don't know how else to do it. // Wait for the focus to return, and depending on the state close the window! triggerWindow.WindowMessages() .Where(m => m.Message == WindowsMessages.WM_SETFOCUS).Delay(TimeSpan.FromSeconds(1)) .Subscribe(info => { if (shareInfo.ApplicationName != null) { return; } shareInfo.ShareTask.TrySetResult(false); }); var windowHandle = new WindowInteropHelper(triggerWindow).Handle; Share(shareInfo, windowHandle, surface, captureDetails).Wait(); Log.Debug().WriteLine("Sharing finished, closing window."); triggerWindow.Close(); if (string.IsNullOrWhiteSpace(shareInfo.ApplicationName)) { exportInformation.ExportMade = false; } else { exportInformation.ExportMade = true; exportInformation.DestinationDescription = shareInfo.ApplicationName; } } catch (Exception ex) { exportInformation.ExportMade = false; exportInformation.ErrorMessage = ex.Message; } ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surfaceToUpload, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails)); SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors); if (jira != null) { try { // Run upload in the background new PleaseWaitForm().ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait), delegate() { jiraPlugin.JiraConnector.addAttachment(jira.Key, filename, new SurfaceContainer(surfaceToUpload, outputSettings, filename)); } ); LOG.Debug("Uploaded to Jira."); exportInformation.ExportMade = true; // TODO: This can't work: exportInformation.Uri = surfaceToUpload.UploadURL; } catch (Exception e) { MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message); } } else { JiraForm jiraForm = new JiraForm(jiraPlugin.JiraConnector); if (jiraPlugin.JiraConnector.isLoggedIn) { jiraForm.setFilename(filename); DialogResult result = jiraForm.ShowDialog(); if (result == DialogResult.OK) { try { // Run upload in the background new PleaseWaitForm().ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait), delegate() { jiraForm.upload(new SurfaceContainer(surfaceToUpload, outputSettings, filename)); } ); LOG.Debug("Uploaded to Jira."); exportInformation.ExportMade = true; // TODO: This can't work: exportInformation.Uri = surfaceToUpload.UploadURL; } catch (Exception e) { MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message); } } } } ProcessExport(exportInformation, surfaceToUpload); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surfaceToUpload, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(Designation, Description); string filename = Path.GetFileName(FilenameHelper.GetFilename(Config.UploadFormat, captureDetails)); SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(Config.UploadFormat, Config.UploadJpegQuality, Config.UploadReduceColors); if (_jiraIssue != null) { try { // Run upload in the background new PleaseWaitForm().ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait), async() => { var surfaceContainer = new SurfaceContainer(surfaceToUpload, outputSettings, filename); await _jiraPlugin.JiraConnector.AttachAsync(_jiraIssue.Key, surfaceContainer); surfaceToUpload.UploadUrl = _jiraPlugin.JiraConnector.JiraBaseUri.AppendSegments("browse", _jiraIssue.Key).AbsoluteUri; } ); Log.DebugFormat("Uploaded to Jira {0}", _jiraIssue.Key); exportInformation.ExportMade = true; exportInformation.Uri = surfaceToUpload.UploadUrl; } catch (Exception e) { MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message); } } else { var jiraForm = new JiraForm(_jiraPlugin.JiraConnector); jiraForm.SetFilename(filename); var dialogResult = jiraForm.ShowDialog(); if (dialogResult == DialogResult.OK) { try { surfaceToUpload.UploadUrl = _jiraPlugin.JiraConnector.JiraBaseUri.AppendSegments("browse", jiraForm.GetJiraIssue().Key).AbsoluteUri; // Run upload in the background new PleaseWaitForm().ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait), async() => { await jiraForm.UploadAsync(new SurfaceContainer(surfaceToUpload, outputSettings, filename)); } ); Log.DebugFormat("Uploaded to Jira {0}", jiraForm.GetJiraIssue().Key); exportInformation.ExportMade = true; exportInformation.Uri = surfaceToUpload.UploadUrl; } catch (Exception e) { MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message); } } } ProcessExport(exportInformation, surfaceToUpload); return(exportInformation); }
public override async Task <ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); var uploadUrl = await Upload(captureDetails, surface); if (uploadUrl != null) { exportInformation.ExportMade = true; exportInformation.Uri = uploadUrl; } ProcessExport(exportInformation, surface); return(exportInformation); }
public override async Task <ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var uploadUrl = await Upload(surface).ConfigureAwait(true); var exportInformation = new ExportInformation(Designation, Description) { ExportMade = uploadUrl != null, Uri = uploadUrl }; ProcessExport(exportInformation, surface); return(exportInformation); }
public override async Task <ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var flickrUri = await Upload(captureDetails, surface); var exportInformation = new ExportInformation(Designation, Description) { ExportMade = flickrUri != null, Uri = flickrUri }; ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(Designation, Description); string uploadUrl = _plugin.Upload(captureDetails, surface); if (uploadUrl != null) { exportInformation.ExportMade = true; exportInformation.Uri = uploadUrl; } ProcessExport(exportInformation, surface); return(exportInformation); }
/// <summary> /// Export the capture to Photobucket /// </summary> /// <param name="manuallyInitiated"></param> /// <param name="surface"></param> /// <param name="captureDetails"></param> /// <returns></returns> public override async Task <ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); var uploaded = await UploadToPhotobucket(surface, _albumPath, captureDetails.Title); if (uploaded != null) { exportInformation.ExportMade = true; exportInformation.Uri = uploaded.Original; } ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); try { ClipboardHelper.SetClipboardData(surface); exportInformation.ExportMade = true; } catch (Exception) { // TODO: Change to general logic in ProcessExport surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetString(LangKey.editor_clipboardfailed)); } ProcessExport(exportInformation, surface); return(exportInformation); }
/// <summary> /// Export the capture to Photobucket /// </summary> /// <param name="manuallyInitiated"></param> /// <param name="surface"></param> /// <param name="captureDetails"></param> /// <returns></returns> public override async Task <ExportInformation> ExportCaptureAsync(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); var outputSettings = new SurfaceOutputSettings(_photobucketConfiguration.UploadFormat, _photobucketConfiguration.UploadJpegQuality, false); var filename = Path.GetFileName(FilenameHelper.GetFilename(_photobucketConfiguration.UploadFormat, captureDetails)); var uploaded = await UploadToPhotobucket(surface, outputSettings, filename, captureDetails.Title, _albumPath); if (uploaded != null) { exportInformation.ExportMade = true; exportInformation.Uri = uploaded.Original; } ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); if (page != null) { try { OneNoteExporter.ExportToPage(surface, page); exportInformation.ExportMade = true; } catch (Exception ex) { exportInformation.ErrorMessage = ex.Message; LOG.Error(ex); } } return(exportInformation); }
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); // Bug #2918756 don't overwrite path if SaveWithDialog returns null! var savedTo = ImageOutput.SaveWithDialog(surface, captureDetails); if (savedTo != null) { exportInformation.ExportMade = true; exportInformation.Filepath = savedTo; captureDetails.Filename = savedTo; _coreConfiguration.OutputFileAsFullpath = savedTo; } ProcessExport(exportInformation, surface); return(exportInformation); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(); if (presetCommand != null) { bool runInBackground = presetCommand.RunInBackground; string fullPath = captureDetails.Filename; if (fullPath == null) { fullPath = ImageOutput.SaveNamedTmpFile(surface, captureDetails, outputSettings); } string output = null; if (runInBackground) { Thread commandThread = new Thread(delegate() { CallExternalCommand(presetCommand, fullPath, out output); }); commandThread.Name = "Running " + presetCommand; commandThread.IsBackground = true; commandThread.Start(); exportInformation.ExportMade = true; } else { try { if (CallExternalCommand(presetCommand, fullPath, out output) == 0) { exportInformation.ExportMade = true; } else { exportInformation.ErrorMessage = output; } } catch (Exception ex) { exportInformation.ErrorMessage = ex.Message; } } //exportInformation.Uri = "file://" + fullPath; } ProcessExport(exportInformation, surface); return(exportInformation); }