private void Preview(Image image) { PreviewForm form; if (Settings.Default.AutoUpload) { var res = ImgurUploader.UploadImage(image); form = new PreviewForm(image, res); } else { form = new PreviewForm(image); } form.Show(); }
private void BeginUploadImage() { BackgroundWorker worker = new BackgroundWorker(); DoWorkEventHandler dw = null; dw = (s, ea) => { worker.DoWork -= dw; ImgurResponse = ImgurUploader.UploadImage(FileName); }; worker.DoWork += dw; RunWorkerCompletedEventHandler rw = null; rw = (s, ea) => { worker.RunWorkerCompleted -= rw; EndUpload(); }; worker.RunWorkerCompleted += rw; worker.RunWorkerAsync(); }
private void uploadButton_Click(object sender, EventArgs e) { BackgroundWorker worker = new BackgroundWorker(); uploading = true; DoWorkEventHandler dw = null; dw = (snd, ea) => { worker.DoWork -= dw; StartUpload(); GotUploadResponse(ImgurUploader.UploadImage(image)); }; worker.DoWork += dw; RunWorkerCompletedEventHandler rw = null; rw = (snd, ea) => { worker.RunWorkerCompleted -= rw; EndUpload(); }; worker.RunWorkerCompleted += rw; worker.RunWorkerAsync(); }