public IConsoleWorker AddWorker(ConsoleWorker newWorker) { WorkerManager manager = new WorkerManager(Writer, newWorker); Workers.Add(manager); return(manager); }
public void RemoveWorker(IConsoleWorker existingWorker) { WorkerManager worker = Workers.FirstOrDefault(w => w.UniqueID.Equals(existingWorker.UniqueID)); if (worker == null) { throw new InvalidOperationException("Worker is not in console"); } Workers.Remove(worker); worker.StopAsync().Wait(); }