public static bool DownloadImage(string ImageId, bool UseDialog = true) { try { ImageDownloadInfo NewInfo = new ImageDownloadInfo(ImageId); if (NewInfo.UseForm) { frmImageDownloader imageDL = new frmImageDownloader(); imageDL.DownloadInfo = NewInfo; switch (UseDialog) { case true: imageDL.ShowDialog(); break; case false: imageDL.Show(); break; } } else { ImageDownloader imageDL = new ImageDownloader(NewInfo); } return(true); } catch { throw; } }
private void btnDownloadImage_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtImageUrl.Text)) { MessageBox.Show("Please enter a valid image url or id"); return; } ImageDownloadInfo NewInfo = new ImageDownloadInfo(txtImageUrl.Text); NewInfo.SeparateRatings = chkImageSeparateRatings.Checked; NewInfo.SeparateGraylisted = chkImageSeparateGraylisted.Checked; NewInfo.SeparateBlacklisted = chkImageSeparateBlacklisted.Checked; NewInfo.SeparateNonImages = chkImageSeparateNonImages.Checked; NewInfo.SeparateArtists = chkImageSeparateArtists.Checked; NewInfo.UseForm = chkImageUseForm.Checked; NewInfo.OpenAfter = chkImageOpenAfter.Checked; if (chkImageUseForm.Checked) { frmImageDownloader Downloader = new frmImageDownloader(); Downloader.DownloadInfo = NewInfo; Downloader.Show(); } else { ImageDownloader Downloader = new ImageDownloader(NewInfo); } }