private void prepareForUpload(UploadArgs args) { // freeze the image so the background thread can access it image.Freeze(); // show progress bar actionProgress.Visibility = System.Windows.Visibility.Visible; worker.RunWorkerAsync(args); }
private void btn3_Click(object sender, RoutedEventArgs e) { int i = 2; UploadArgs args = new UploadArgs(); args.dll = this.dlls.Values.ElementAt(i); if (this.dlls.Values.ElementAt(i).isLocal()) { Microsoft.Win32.SaveFileDialog dialog = new Microsoft.Win32.SaveFileDialog(); dialog.Filter = "Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif"; dialog.Title = "Choose a location to save your screenshot"; dialog.ShowDialog(); if (!String.IsNullOrEmpty(dialog.FileName)) { args.location = dialog.FileName; } } prepareForUpload(args); }
private void worker_DoWork(object sender, DoWorkEventArgs e) { // retrieve arguments UploadArgs args = (UploadArgs)e.Argument; String link = String.Empty; Reflection plugin = new Reflection(); plugin.loadDLL(args.dll); if (args.location != null) { plugin.setSaveLocation(args.location); } if (plugin != null) { plugin.upload(image); link = plugin.getUrl(); } lastLink = link; e.Result = link; }