aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs
blob: d293c44185f18984ad4f66f531ed1e8f0d84926e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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<MachineOverviewErrorItem> Winders {  get; set; }

        public ObservableCollection<MachineOverviewErrorItem> Dancers { get; set; }

        public ObservableCollection<MachineOverviewErrorItem> BTSRs { get; set; }

        public MachineOverviewErrorStates()
        {
            Winders = new ObservableCollection<MachineOverviewErrorItem>();
            Dancers = new ObservableCollection<MachineOverviewErrorItem>();
            BTSRs = new ObservableCollection<MachineOverviewErrorItem>();
            for ( int i = 0; i < 4 ; i++)
            {
                Winders.Add( new MachineOverviewErrorItem());
                Dancers.Add(new MachineOverviewErrorItem());
                BTSRs.Add(new MachineOverviewErrorItem());
            }
        }

        public void UpdateWinders(List<bool> updates)
        {
            UpdateCollection(Winders, updates);
        }
        public void UpdateDancers(List<bool> updates)
        {
            UpdateCollection(Dancers, updates);
        }
        public void UpdateBTSRs(List<bool> updates)
        {
            UpdateCollection(BTSRs, updates);
        }

        private void UpdateCollection(ObservableCollection<MachineOverviewErrorItem> collection, List<bool> updates )
        {
            if (collection.Count == updates.Count)
            {
                for (int i = 0; i < collection.Count; i++)
                {
                    collection[i].IsErrorState = updates[i];
                }
            }
        }
    }
}