/// <summary> /// Sets Clipboard text and returns the content /// </summary> /// <returns></returns> public static string SetClipboardText(WorkerTask task, bool showDialog) { string clipboardText = ""; switch (task.JobCategory) { case JobCategoryType.PICTURES: case JobCategoryType.SCREENSHOTS: case JobCategoryType.BINARY: ScreenshotsHistory = task.LinkManager; if (GraphicsMgr.IsValidImage(task.LocalFilePath)) { if (Engine.conf.ShowClipboardModeChooser || showDialog) { ClipboardOptions cmp = new ClipboardOptions(task); cmp.Icon = Resources.zss_main; if (showDialog) { cmp.ShowDialog(); } else { cmp.Show(); } } if (task.MyImageUploader == ImageDestType.FILE) { clipboardText = task.LocalFilePath; } else { clipboardText = ScreenshotsHistory.GetUrlByType(Engine.conf.ClipboardUriMode).ToString().Trim(); if (task.MakeTinyURL) { string tinyUrl = ScreenshotsHistory.GetUrlByType(ClipboardUriType.FULL_TINYURL); if (!string.IsNullOrEmpty(tinyUrl)) { clipboardText = tinyUrl.Trim(); } } } } break; case JobCategoryType.TEXT: switch (task.Job) { case WorkerTask.Jobs.LANGUAGE_TRANSLATOR: if (null != task.TranslationInfo) { clipboardText = task.TranslationInfo.Result.TranslatedText; } break; default: if (!string.IsNullOrEmpty(task.RemoteFilePath)) { clipboardText = task.RemoteFilePath; } else if (null != task.MyText) { clipboardText = task.MyText.LocalString; } else { clipboardText = task.LocalFilePath; } break; } break; } // after all this the clipboard text can be null if (!string.IsNullOrEmpty(clipboardText)) { Engine.ClipboardUnhook(); FileSystem.AppendDebug("Setting Clipboard with URL: " + clipboardText); Clipboard.SetText(clipboardText); // optional deletion link string linkdel = ScreenshotsHistory.GetDeletionLink(); if (!string.IsNullOrEmpty(linkdel)) { FileSystem.AppendDebug("Deletion Link: " + linkdel); } Engine.zClipboardText = clipboardText; Engine.ClipboardHook(); } return(clipboardText); }