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. --- .../Tango.PPC.UI/Images/Overview Icons/Error.png | Bin 831 -> 2146 bytes .../Tango.PPC.UI/Images/Overview Icons/Normal.png | Bin 779 -> 1407 bytes .../Models/MachineOverviewErrorItem.cs | 26 ++++++ .../Models/MachineOverviewErrorStates.cs | 56 ++++++++++++ .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 4 +- .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 16 +++- .../PPC/Tango.PPC.UI/Views/MachineStatusView.xaml | 100 ++++++++++----------- .../Tango.Emulations/Emulators/MachineEmulator.cs | 16 +++- 8 files changed, 165 insertions(+), 53 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorStates.cs (limited to 'Software') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Error.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Error.png index b9138f444..a5a178bdb 100644 Binary files a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Error.png and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Error.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Normal.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Normal.png index a562e9228..8ddeecbe0 100644 Binary files a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Normal.png and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/Normal.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs new file mode 100644 index 000000000..3925a1752 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/MachineOverviewErrorItem.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.UI.Models +{ + public class MachineOverviewErrorItem : ExtendedObject + { + private bool _isErrorState; + + public bool IsErrorState + { + get { return _isErrorState; } + set { _isErrorState = value; RaisePropertyChangedAuto();} + } + + public MachineOverviewErrorItem() + { + IsErrorState = false; + } + + } +} 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]; + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 51600b0e8..a3ec9667f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -238,9 +238,11 @@ + + @@ -962,7 +964,7 @@ if $(ConfigurationName) == Eureka copy /Y "$(ProjectDir)Intro.wmv" "$(TargetDir) - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index 828047ccf..1182ba50e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -206,7 +206,9 @@ namespace Tango.PPC.UI.ViewModels get { return _jobOutlineTicket; } set { _jobOutlineTicket = value; RaisePropertyChangedAuto(); } } - + + public MachineOverviewErrorStates MachineErrorStates { get; set; } + #endregion #region Commands @@ -254,6 +256,7 @@ namespace Tango.PPC.UI.ViewModels IsWeghtView = false; OverviewModel = new MachineOverviewModel(); + MachineErrorStates = new MachineOverviewErrorStates(); } public override void OnApplicationReady() @@ -275,6 +278,7 @@ namespace Tango.PPC.UI.ViewModels private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status) { UpdateMidTankLevels(status); + UpdateMachineStatusErrors(status); } private void UpdateMidTankLevels(MachineStatus status) { @@ -348,6 +352,16 @@ namespace Tango.PPC.UI.ViewModels } } + private void UpdateMachineStatusErrors(MachineStatus status) + { + var windersInError = status.WindersInError.ToList();// to test + MachineErrorStates.UpdateWinders(windersInError); + var dansersInError = status.DancersInError.ToList(); + MachineErrorStates.UpdateDancers(dansersInError); + var btsrsInErrors = status.BtsrsInError.ToList(); + MachineErrorStates.UpdateBTSRs(btsrsInErrors); + } + private void MachineOperator_InkFillingStatusChanged(object sender, InkFillingStatusChangedEventArgs e) { //foreach (var cartridge in e.Status.CartridgesStatuses.Where(x => x.Cartridge.Slot != CartridgeSlot.Ink)) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index 666fffe72..b6bda0892 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -168,19 +168,25 @@ - + + + + + + @@ -963,43 +990,25 @@ - - - - - - - - + + + + + + + Winder - - - - - - - - - + + + + + + + + Dancer @@ -1007,22 +1016,13 @@ - - - - - - - - + + + + + + + BTSR diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 3543b8b3a..0e00bee3e 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -170,8 +170,22 @@ namespace Tango.Emulations.Emulators MidTankLevel = 2.5, }); } + for (int i = 0; i < 4; i++) + { + if( i == 2) + { + MachineStatus.WindersInError.Add(false); + MachineStatus.DancersInError.Add(true); + MachineStatus.BtsrsInError.Add(true); + } + else { + MachineStatus.WindersInError.Add(false); + MachineStatus.DancersInError.Add(false); + MachineStatus.BtsrsInError.Add(false); + } + } - EventsStates = MachineEventState.GetAllEventsStates(); + EventsStates = MachineEventState.GetAllEventsStates(); _valveStates = new List(); _blower_states = new List(); -- cgit v1.3.1