public bool Upload(ICaptureDetails captureDetails, Image image) { using (MemoryStream stream = new MemoryStream()) { SurfaceOutputSettings outputSettings = new SurfaceOutputSettings { Format = config.UploadFormat, JPGQuality = config.UploadJpegQuality }; ImageOutput.SaveToStream(image, null, stream, outputSettings); byte[] buffer = stream.GetBuffer(); try { string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails)); string contentType = $"image/{config.UploadFormat}"; TFSInfo tfsInfo = TFSUtils.UploadToTFS(buffer, captureDetails.DateTime.ToString(CultureInfo.CurrentCulture), filename, contentType); if (tfsInfo == null) { return(false); } else { if (config.TfsUploadHistory == null) { config.TfsUploadHistory = new Dictionary <string, string>(); } if (tfsInfo.ID != null) { LOG.InfoFormat("Storing TFS upload for id {0}", tfsInfo.ID); config.TfsUploadHistory.Add(tfsInfo.ID, tfsInfo.ID); config.runtimeTfsHistory.Add(tfsInfo.ID, tfsInfo); } // Make sure the configuration is save, so we don't lose the deleteHash IniConfig.Save(); // Make sure the history is loaded, will be done only once TFSUtils.LoadHistory(); // Show if (config.AfterUploadOpenHistory) { TFSHistory.ShowHistory(); } if (config.AfterUploadLinkToClipBoard && !string.IsNullOrEmpty(tfsInfo.WebEditUrl)) { Clipboard.SetText(tfsInfo.WebEditUrl); } if (config.AfterUploadOpenWorkItem && !string.IsNullOrEmpty(tfsInfo.WebEditUrl)) { System.Diagnostics.Process.Start(tfsInfo.WebEditUrl); } return(true); } } catch (Exception e) { MessageBox.Show(Language.GetString("tfs", $"{LangKey.upload_failure} {e}")); } finally { //backgroundForm.CloseDialog(); } } return(false); }
void ButtonHistoryClick(object sender, EventArgs e) { TFSHistory.ShowHistory(); }
public void HistoryMenuClick(object sender, EventArgs eventArgs) { TFSUtils.LoadHistory(); TFSHistory.ShowHistory(); }