From 23f4bd3bb2f7ff5e0814555efe1c6115f32c49c4 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 9 Apr 2023 20:27:29 +0300 Subject: Notifications list, GUI changes. --- .../Converters/CollectionToCountConverter.cs | 30 +++ .../Images/Job Issues/Machine outline.png | Bin 0 -> 3459 bytes .../Notifications/DefaultNotificationProvider.cs | 2 + .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 4 +- .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 126 ++++++++++-- .../PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml | 2 +- .../PPC/Tango.PPC.UI/Views/MachineStatusView.xaml | 226 +++++++++++++-------- 7 files changed, 284 insertions(+), 106 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/CollectionToCountConverter.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Job Issues/Machine outline.png (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/CollectionToCountConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/CollectionToCountConverter.cs new file mode 100644 index 000000000..b227aa5f8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/CollectionToCountConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace Tango.PPC.UI.Converters +{ + public class CollectionToCountConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var collection = value as System.Collections.ICollection; + if (collection != null) + { + return collection.Count; + } + return 0; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Job Issues/Machine outline.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Job Issues/Machine outline.png new file mode 100644 index 000000000..67c89b46e Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Job Issues/Machine outline.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index ac1972f5f..cc8f7b4ab 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -303,6 +303,7 @@ namespace Tango.PPC.UI.Notifications item.RemoveAction = () => { PopNotification(item); }; NotificationItems.Insert(0, item); RaisePropertyChanged(nameof(HasNotificationItems)); + RaisePropertyChanged(nameof(NotificationItems)); return item; } @@ -325,6 +326,7 @@ namespace Tango.PPC.UI.Notifications LogManager.Log($"Popping out NotificationItem '{item.GetType().Name}'."); NotificationItems.Remove(item); RaisePropertyChanged(nameof(HasNotificationItems)); + RaisePropertyChanged(nameof(NotificationItems)); } /// 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 7ed27a3ce..ec2e6b1a0 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 @@ -140,6 +140,7 @@ RunningJobViewerEureka.xaml + @@ -553,6 +554,7 @@ + @@ -877,7 +879,7 @@ if $(ConfigurationName) == Debug "rc.exe" "$(TargetPath)" --set-version-string " - + \ No newline at end of file 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 f9bc4cefb..8e5d3e0f9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.BL.Enumerations; using Tango.Core.Commands; using Tango.Integration.Operation; using Tango.PPC.Common; @@ -44,7 +45,9 @@ namespace Tango.PPC.UI.ViewModels IsDyeingProcess = (_runningJobStatus != null && _runningJobStatus.CurrentSegment != null); if(_runningJobStatus != null && _runningJobStatus.CurrentSegment != null) { - CurrentBrushStop = _runningJobStatus.CurrentSegment.FirstBrushStop; + var segment = Job.Segments.FirstOrDefault(x=>x.SegmentIndex == _runningJobStatus.CurrentSegment.SegmentIndex); + if(segment != null) + CurrentBrushStop = segment.FirstBrushStop; } RaisePropertyChangedAuto(); } @@ -101,11 +104,56 @@ namespace Tango.PPC.UI.ViewModels if(_currentBrushStop != value) { _currentBrushStop = value; + OnUpdateCurrentBrush(); RaisePropertyChangedAuto(); } } } + public double CyanOutput + { + get { return GetVolumeLiquidType(LiquidTypes.Cyan); } + } + + public double MagentaOutput + { + get { return GetVolumeLiquidType(LiquidTypes.Magenta); } + } + + public double YellowOutput + { + get { return GetVolumeLiquidType(LiquidTypes.Yellow); } + } + + public double BlackOutput + { + get { return GetVolumeLiquidType(LiquidTypes.Black); } + } + + public double LightCyanOutput + { + get { return GetVolumeLiquidType(LiquidTypes.LightCyan); } + } + + public double LightMagentaOutput + { + get { return GetVolumeLiquidType(LiquidTypes.LightMagenta); } + } + + public double LightYellowOutput + { + get { return GetVolumeLiquidType(LiquidTypes.LightYellow); } + } + + //public double TransparentInkOutput + //{ + // get { return GetVolumeLiquidType(LiquidTypes.TransparentInk); } + //} + + //public double LubricantOutput + //{ + // get { return GetVolumeLiquidType(LiquidTypes.Lubricant); } + //} #endregion @@ -127,6 +175,8 @@ namespace Tango.PPC.UI.ViewModels /// public RelayCommand OverviewViewCommand { get; set; } + public RelayCommand ClearAllNotificationsCommand { get; set; } + #endregion public MachineStatusViewVM() @@ -136,23 +186,21 @@ namespace Tango.PPC.UI.ViewModels GoToJobCommand = new RelayCommand(GoToJob, () => CanStopped()); JobStatusViewCommand = new RelayCommand(JobStatusView); OverviewViewCommand = new RelayCommand(OverviewView); + ClearAllNotificationsCommand = new RelayCommand(ClearAllNotifications); IsJobStatusViewEnable = true; IsEnabledStopButton = false; IsSpoolView = false; } - + + #region printing + public override void OnApplicationStarted() { MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; } - - private bool CanStopped() - { - return IsEnabledStopButton; - } - + private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { _handler = e.JobHandler; @@ -211,17 +259,10 @@ namespace Tango.PPC.UI.ViewModels AbortCommand.RaiseCanExecuteChanged(); }); } + + #endregion - private void StopJob() - { - _handler?.Cancel(); - } - - private void AbortJob() - { - _handler?.Cancel(); - Job = null; - } + #region Methods private void GoToJob() { @@ -230,8 +271,6 @@ namespace Tango.PPC.UI.ViewModels NavigationManager.ClearHistoryExcept(); } - #region Public Methods - /// /// Toggles the application technician mode. /// @@ -246,9 +285,7 @@ namespace Tango.PPC.UI.ViewModels ApplicationManager.ExitTechnicianMode(); } } - - protected void JobStatusView() { IsJobStatusViewEnable = true; @@ -259,6 +296,51 @@ namespace Tango.PPC.UI.ViewModels IsJobStatusViewEnable = false; } + private double GetVolumeLiquidType(LiquidTypes liquidType) + { + if(CurrentBrushStop != null && CurrentBrushStop.LiquidVolumes != null && CurrentBrushStop.LiquidVolumes.Count > 0) + { + var lt = CurrentBrushStop.LiquidVolumes.FirstOrDefault(x => x.LiquidType == liquidType); + + if (lt != null) + { + return Math.Round(lt.Volume, 2); + } + } + return 0; + } + + private bool CanStopped() + { + return IsEnabledStopButton; + } + + private void StopJob() + { + _handler?.Cancel(); + } + + private void AbortJob() + { + _handler?.Cancel(); + Job = null; + } + + protected void ClearAllNotifications() + { + NotificationProvider.NotificationItems.Where(x=>x.CanClose).ToList().ForEach(y=> NotificationProvider.PopNotification(y)); + } + + protected void OnUpdateCurrentBrush() + { + RaisePropertyChanged(nameof(CyanOutput)); + RaisePropertyChanged(nameof(LightCyanOutput)); + RaisePropertyChanged(nameof(MagentaOutput)); + RaisePropertyChanged(nameof(LightMagentaOutput)); + RaisePropertyChanged(nameof(YellowOutput)); + RaisePropertyChanged(nameof(LightYellowOutput)); + RaisePropertyChanged(nameof(BlackOutput)); + } #endregion } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml index fe42576b4..10750bba3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml @@ -208,7 +208,7 @@ - + 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 d98a8823d..18c9b3adb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -7,15 +7,16 @@ xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:locaControls="clr-namespace:Tango.PPC.UI.Controls" - xmlns:locaConverters="clr-namespace:Tango.PPC.UI.Converters" + xmlns:localConverters="clr-namespace:Tango.PPC.UI.Converters" xmlns:global="clr-namespace:Tango.PPC.UI" xmlns:local="clr-namespace:Tango.PPC.UI.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="932" d:DataContext="{d:DesignInstance Type=vm:MachineStatusViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineStatusViewVM}"> - - + + + + - + - - - - - - - - - + + + + + + + + + - - - - - - - - + + + - + + + + + + + + + - + -- cgit v1.3.1