public void RunAsync(FileInfo oprfile, RunProgress progress, RunCompleted completed) { if (_status == RunStatus.running) { throw new Exception("Already running, cannot start additional run"); } _oprfile = oprfile; worker = new BackgroundWorker(); worker.DoWork += new DoWorkEventHandler(DoRun); _reportProgress = progress != null; this.progress = progress; this.completed = completed; worker.WorkerReportsProgress = _reportProgress; worker.WorkerSupportsCancellation = _allowCancel; worker.RunWorkerCompleted += worker_RunWorkerCompleted; worker.ProgressChanged += worker_ProgressChanged; worker.RunWorkerAsync(); _status = RunStatus.running; }
void IProgress <JenkinsRunProgress> .Report(JenkinsRunProgress value) { RunProgress?.Invoke(this, value); }