public UploadTestForm() { InitializeComponent(); Icon = ShareXResources.Icon; if (TestImage == null) { TestImage = Resources.Test; } if (string.IsNullOrEmpty(TestText)) { TestText = Program.ApplicationName + " text upload test"; } if (string.IsNullOrEmpty(TestURL)) { TestURL = Links.URL_WEBSITE; } ListViewItem lvi; ListViewGroup imageUploadersGroup = new ListViewGroup("Image Uploaders", HorizontalAlignment.Left); ListViewGroup textUploadersGroup = new ListViewGroup("Text Uploaders", HorizontalAlignment.Left); ListViewGroup fileUploadersGroup = new ListViewGroup("File Uploaders", HorizontalAlignment.Left); ListViewGroup urlShortenersGroup = new ListViewGroup("URL Shorteners", HorizontalAlignment.Left); lvUploaders.Groups.AddRange(new[] { imageUploadersGroup, textUploadersGroup, fileUploadersGroup, urlShortenersGroup }); foreach (ImageDestination uploader in Enum.GetValues(typeof(ImageDestination))) { switch (uploader) { case ImageDestination.Twitsnaps: // Not possible to upload without post Twitter case ImageDestination.FileUploader: // We are going to test this in File Uploader tests continue; } lvi = new ListViewItem(uploader.GetDescription()); TaskSettings defaultTaskSettings = TaskSettings.GetDefaultTaskSettings(); UploadTask task = UploadTask.CreateImageUploaderTask((Image)TestImage.Clone(), defaultTaskSettings); task.Info.TaskSettings.ImageDestination = uploader; lvi.Tag = task; lvi.Group = imageUploadersGroup; lvUploaders.Items.Add(lvi); } foreach (TextDestination uploader in Enum.GetValues(typeof(TextDestination))) { switch (uploader) { case TextDestination.FileUploader: continue; } lvi = new ListViewItem(uploader.GetDescription()); TaskSettings defaultTaskSettings = TaskSettings.GetDefaultTaskSettings(); UploadTask task = UploadTask.CreateTextUploaderTask(TestText, defaultTaskSettings); task.Info.TaskSettings.TextDestination = uploader; lvi.Tag = task; lvi.Group = textUploadersGroup; lvUploaders.Items.Add(lvi); } foreach (FileDestination uploader in Enum.GetValues(typeof(FileDestination))) { switch (uploader) { case FileDestination.CustomFileUploader: case FileDestination.SharedFolder: case FileDestination.Email: continue; } lvi = new ListViewItem(uploader.GetDescription()); TaskSettings defaultTaskSettings = TaskSettings.GetDefaultTaskSettings(); UploadTask task = UploadTask.CreateImageUploaderTask((Image)TestImage.Clone(), defaultTaskSettings); task.Info.TaskSettings.ImageDestination = ImageDestination.FileUploader; task.Info.TaskSettings.FileDestination = uploader; lvi.Tag = task; lvi.Group = fileUploadersGroup; lvUploaders.Items.Add(lvi); } foreach (UrlShortenerType uploader in Enum.GetValues(typeof(UrlShortenerType))) { lvi = new ListViewItem(uploader.GetDescription()); TaskSettings defaultTaskSettings = TaskSettings.GetDefaultTaskSettings(); UploadTask task = UploadTask.CreateURLShortenerTask(TestURL, defaultTaskSettings); task.Info.TaskSettings.URLShortenerDestination = uploader; lvi.Tag = task; lvi.Group = urlShortenersGroup; lvUploaders.Items.Add(lvi); } PrepareListItems(); }