private void Upload(BlackBoxReport report, SteppedProgressManager overallProgress, ProgressManager reportProgress) { //Upload the report. UploadWorker.ReportProgress((int)(overallProgress.Progress * 100), S._("Compressing Report {0}", report.Name)); reportProgress.Total = int.MaxValue; BlackBoxReportUploader uploader = new BlackBoxReportUploader(report); uploader.Submit(delegate(object from, EraserProgressChangedEventArgs e2) { SteppedProgressManager reportSteps = (SteppedProgressManager)e2.Progress; reportProgress.Completed = (int)(reportSteps.Progress * reportProgress.Total); int step = reportSteps.Steps.IndexOf(reportSteps.CurrentStep); UploadWorker.ReportProgress((int)(overallProgress.Progress * 100), step == 0 ? S._("Compressing Report {0}", report.Name) : S._("Uploading Report {0}", report.Name)); if (UploadWorker.CancellationPending) { throw new OperationCanceledException(); } }); }
private void button3_Click(object sender, EventArgs e) // Stop Button { UploadWorker.CancelAsync(); listBox1.Items.Clear(); listBox1.Items.Add("BOT | Uploading cancelled."); EnableAllButtons(); }
private void BlackBoxUploadForm_FormClosing(object sender, FormClosingEventArgs e) { if (UploadWorker.IsBusy) { UploadWorker.CancelAsync(); e.Cancel = true; } }
private void CancelBtn_Click(object sender, EventArgs e) { if (UploadWorker.IsBusy) { UploadWorker.CancelAsync(); } else { Close(); } }
private void CheckStatus(BlackBoxReport report, SteppedProgressManager overallProgress, ProgressManager reportProgress) { //Upload the report. UploadWorker.ReportProgress((int)(overallProgress.Progress * 100), S._("Checking for solution for {0}...", report.Name)); BlackBoxReportUploader uploader = new BlackBoxReportUploader(report); report.Status = uploader.Status; }
private void StartUpload() { if (!UploadWorker.IsBusy) { LoadConfig(); listBox1.Items.Clear(); listBox1.Items.Add("BOT | Starting a upload session."); DisableAllButtons(); UploadWorker.RunWorkerAsync(); } }
public MainWindow(DatabaseReader reader, Uploader uploader) { InitializeComponent(); this.DataContext = this; _reader = reader; _uploader = uploader; Events = new ObservableCollection <LogItem>(); UploadQueue = new ConcurrentQueue <UploadEvent>(); ActiveOnly = true; ((CollectionViewSource)this.Resources["FilteredTournaments"]).Filter += (sender, e) => { TrackableTournament t = e.Item as TrackableTournament; e.Accepted = !ActiveOnly || t.Tournament.Active; }; _worker = new UploadWorker(this.UploadQueue, this.AddEvent); _workerThread = new Thread(_worker.DoUpload); _workerThread.IsBackground = true; _workerThread.Start(); Tournaments = new ObservableCollection <TrackableTournament>(from t in _reader.getAllTournaments() select new TrackableTournament(t)); new CheckTournamentsDelegate(CheckTournaments).BeginInvoke(null, null); }
/// <summary> /// Constructor. /// </summary> /// <param name="reports">The list of reports to upload.</param> public BlackBoxUploadForm(IList <BlackBoxReport> reports) { InitializeComponent(); Theming.ApplyTheme(this); UploadWorker.RunWorkerAsync(reports); }