public void RefreshJobs() { if (AllJobs == null) { return; } AllJobs.Clear(); var list = experienceRepos.GetAllDecorators(); foreach (var job in list) { AllJobs.Add(job); job.PropertyChanged += Job_PropertyChanged; } }
private void SetUpCollectionEvents() { batteries.ItemAdded += delegate(Battery bat) { AllBatteries.Add(bat.UID, bat); bat.AssignHub(_source); }; batteries.ItemRemoved += delegate(Battery bat) { BatteriesWithNoDrones.Remove(bat.UID); AllBatteries.Remove(bat.UID); }; drones.ItemAdded += delegate(IDataSource drone) { ((Drone)drone).AssignHub(_source); AllDrones.Add(drone.UID, drone); DronesWithNoJobs.Add(drone.UID, (Drone)drone); }; drones.ItemRemoved += delegate(IDataSource drone) { AllDrones.Remove(drone); DronesWithNoJobs.Remove((Drone)drone); }; DronesWithNoJobs.ItemAdded += (drone) => { drone.transform.SetParent(_source.transform); }; DronesWithNoJobs.ItemRemoved += (drone) => { drone.transform.SetParent(Drone.ActiveDrones); }; completedJobs.ItemAdded += delegate(IDataSource job) { incompleteJobs.Remove(job); AllCompleteJobs.Add(job.UID, job); }; completedJobs.ItemRemoved += (job) => AllCompleteJobs.Remove(job); incompleteJobs.ItemAdded += delegate(IDataSource job) { AllJobs.Add(job.UID, (Job)job); AllIncompleteJobs.Add(job.UID, job); }; incompleteJobs.ItemRemoved += (job) => AllIncompleteJobs.Remove(job); }
public void EndJob() { CurrentJob.EndTime = DateTime.Now; AllJobs.Add(CurrentJob); CurrentJob = null; }