From bc94c84ee20ea01618241e8a4d32c2a77b4084cc Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 23 May 2023 16:49:49 +0300 Subject: Added data processing of BtsrsInError, DancersInError, WindersInError in GUI. --- .../Models/MachineOverviewErrorStates.cs | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs new file mode 100644 index 000000000..d293c4418 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs @@ -0,0 +1,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 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]; + } + } + } + } +} -- cgit v1.3.1 From d7a0d5e8d6804f5f739c223c123b4b2780af4e11 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 24 May 2023 11:16:50 +0300 Subject: Added Lo error in case when WindersInErrors and... array is less then 4. --- .../Models/MachineOverviewErrorStates.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs index d293c4418..1863b01e1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs @@ -31,18 +31,27 @@ namespace Tango.PPC.UI.Models public void UpdateWinders(List updates) { - UpdateCollection(Winders, updates); + if(!UpdateCollection(Winders, updates)) + { + LogManager.Log("Error in display Winders Errors. Number of Winders In Error is less then 4!"); + } } public void UpdateDancers(List updates) { - UpdateCollection(Dancers, updates); + if(!UpdateCollection(Dancers, updates)) + { + LogManager.Log("Error in display Dancers Errors. Number of Dancers In Error is less then 4!"); + } } public void UpdateBTSRs(List updates) { - UpdateCollection(BTSRs, updates); + if(!UpdateCollection(BTSRs, updates)) + { + LogManager.Log("Error in display BTSRs Errors. Number of BTSRs In Error is less then 4!"); + } } - private void UpdateCollection(ObservableCollection collection, List updates ) + private bool UpdateCollection(ObservableCollection collection, List updates ) { if (collection.Count == updates.Count) { @@ -50,7 +59,10 @@ namespace Tango.PPC.UI.Models { collection[i].IsErrorState = updates[i]; } + return true; } + return false; + } } } -- cgit v1.3.1