public void Run() { if (worker == null) { throw new Exception("Worker cannot be run before it exists."); //todo specific exception } if (worker.IsBusy) { return; } worker.RunWorkerAsync(); UpdateStatusText?.Invoke(this, new TextEventArgs("Applying color...")); }
private void OnCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { UpdateStatusText?.Invoke(this, new TextEventArgs("Error occurred.")); return; } if (queue.Count > 0) { Run(); } else { UpdateStatusText?.Invoke(this, new TextEventArgs("")); } }