示例#1
0
        public IConsoleWorker AddWorker(ConsoleWorker newWorker)
        {
            WorkerManager manager = new WorkerManager(Writer, newWorker);

            Workers.Add(manager);
            return(manager);
        }
示例#2
0
        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();
        }