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 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; }