internal void Remove(MovieTask task) { if (_collection.ContainsKey(task.GetSubscription())) { _collection.Remove(task.GetSubscription()); } }
private void Task_Completed(MovieTask sender) { // var runningTasks = TaskCollection.GetAll().Where(i => i.IsBusy).Count(); var runningTasks = TaskCollection.Count(); if (runningTasks == 0) { //EventAggregator.GetEvent<LongProcessCompletedEvent>(). // Publish(1); Console.WriteLine("All processes completed."); } else if (runningTasks == 1) { //EventAggregator.GetEvent<LongProcessStartedEvent>(). // Publish(TaskCollection.GetAll().First().GetMessage()); //publish message } else if (runningTasks > 1) { //EventAggregator.GetEvent<LongProcessStartedEvent>(). // Publish(string.Format("{0} processing running.", runningTasks)); Console.WriteLine(string.Format("{0} processes running.", runningTasks)); } TaskCollection.Remove(sender); }
internal void Add(MovieTask task) { _collection.Add(task.GetSubscription(), task); }