/// <summary> /// Import data from the clipboard to upload. /// </summary> private void ButtonImport(object sender, EventArgs e) { if (Clipboard.ContainsFileDropList()) { var files = Clipboard.GetFileDropList(); Uploader.Upload((from string file in files select new UploadFile { Path = file }).ToArray()); } else if (Clipboard.ContainsImage()) { if (!Uploader.UploadImage(Clipboard.GetImage())) { Misc.HandleError(new Exception(Resources.UploadFailed), Resources.Import); } } else if (Clipboard.ContainsText()) { if (!Uploader.UploadText(Clipboard.GetText())) { Misc.HandleError(new Exception(Resources.UploadFailed), Resources.Import); } } else { var dataObject = Clipboard.GetDataObject(); if (dataObject != null) { Misc.HandleError(new ArgumentException(string.Format(Resources.CannotHandleContentTypes, string.Join(",", dataObject.GetFormats()))), Resources.Import); } else { Misc.HandleError(new ArgumentException(Resources.UnsupportedData), Resources.Import); } } }
/// <summary> /// Reupload the last screenshot. /// </summary> private void ReuploadScreenshot(object sender, EventArgs e) { Uploader.UploadImage(_screenshot); }