using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core; namespace Tango.PPC.UI.Models { public class MachineOverviewErrorStates : ExtendedObject { public ObservableCollection Winders { get; set; } public ObservableCollection Dancers { get; set; } public ObservableCollection BTSRs { get; set; } public MachineOverviewErrorStates() { Winders = new ObservableCollection(); Dancers = new ObservableCollection(); BTSRs = new ObservableCollection(); for ( int i = 0; i < 4 ; i++) { Winders.Add( new MachineOverviewErrorItem()); Dancers.Add(new MachineOverviewErrorItem()); BTSRs.Add(new MachineOverviewErrorItem()); } } public void UpdateWinders(List updates) { UpdateCollection(Winders, updates); } public void UpdateDancers(List updates) { UpdateCollection(Dancers, updates); } public void UpdateBTSRs(List updates) { UpdateCollection(BTSRs, updates); } private void UpdateCollection(ObservableCollection collection, List updates ) { if (collection.Count == updates.Count) { for (int i = 0; i < collection.Count; i++) { collection[i].IsErrorState = updates[i]; } } } } }