From 1133972c0c51feb478aa3944fad5f374a8a2da35 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 18 Apr 2023 20:25:46 +0300 Subject: Added connective icons and time to bottom of menu. --- .../Converters/ProgressLengthSpoolConverter.cs | 20 +-- .../Converters/ProgressWeightSpoolConverter.cs | 67 ++++++++ .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 1 + .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 21 +++ .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 2 +- .../PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml | 188 ++++++++------------- .../PPC/Tango.PPC.UI/Views/MachineStatusView.xaml | 23 ++- 7 files changed, 181 insertions(+), 141 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs index 00473955b..3be7a8818 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs @@ -15,13 +15,11 @@ namespace Tango.PPC.UI.Converters { try { - if (values.Count() == 4) + if (values.Count() == 2) { double length = System.Convert.ToDouble(values[0]); - int spools = System.Convert.ToInt32(values[1]); - int NumberOfUnits = System.Convert.ToInt32(values[2]); - bool forOneSpool = System.Convert.ToBoolean(values[3]); - var totalBy4Spools = (double)length* spools * NumberOfUnits/ 4; + bool forOneSpool = System.Convert.ToBoolean(values[1]); + var totalBy4Spools = (double)length*4;// spools ; if (forOneSpool) { return (double)totalBy4Spools / 4; @@ -29,16 +27,14 @@ namespace Tango.PPC.UI.Converters return totalBy4Spools; } - if (values.Count() == 5) + if (values.Count() == 3) { double length = System.Convert.ToDouble(values[0]); - int spools = System.Convert.ToInt32(values[1]); - int NumberOfUnits = System.Convert.ToInt32(values[2]); - bool forOneSpool = System.Convert.ToBoolean(values[3]); - double currentProgresslength = System.Convert.ToDouble(values[4]) ; + bool forOneSpool = System.Convert.ToBoolean(values[1]); + double currentProgresslength = System.Convert.ToDouble(values[2]) ; - var totalBy4Spools = (double)length * spools * NumberOfUnits / 4; - var currentProgressBy4Spools = (double)currentProgresslength * spools ; + var totalBy4Spools = (double)length * 4; + var currentProgressBy4Spools = (double)currentProgresslength * 4 ; int coeff = (int)currentProgressBy4Spools / (int)totalBy4Spools; var progressCurrent = coeff == 0 ? currentProgressBy4Spools : currentProgressBy4Spools % (coeff * totalBy4Spools);//show for progress diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs new file mode 100644 index 000000000..05a41912c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + + +namespace Tango.PPC.UI.Converters +{ + public class ProgressWeightSpoolConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values.Count() == 3) + { + double length = System.Convert.ToDouble(values[0]); + bool forOneSpool = System.Convert.ToBoolean(values[1]); + double coef = System.Convert.ToDouble(values[2]); + var totalBy4Spools = (double)length * 4;// spools ; + + var weight = ((double)totalBy4Spools * coef) / (1000);//(g) + if (forOneSpool) + { + return (double)weight / 4; + } + return weight; + + } + if (values.Count() == 4) + { + double length = System.Convert.ToDouble(values[0]); + bool forOneSpool = System.Convert.ToBoolean(values[1]); + double currentProgresslength = System.Convert.ToDouble(values[2]); + double coef = System.Convert.ToDouble(values[3]); + + var totalBy4Spools = (double)length * 4; + var currentProgressBy4Spools = (double)currentProgresslength * 4; + + int coeff = (int)currentProgressBy4Spools / (int)totalBy4Spools; + var progressCurrent = coeff == 0 ? currentProgressBy4Spools : currentProgressBy4Spools % (coeff * totalBy4Spools);//show for progress + var weight = ((double)progressCurrent * coef) / (1000);//(g) + if (forOneSpool) + { + return (double)weight / 4; + + } + return weight; + } + return "-"; + } + catch + { + return "-"; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} 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 d32900728..1534d8a73 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 @@ -145,6 +145,7 @@ + BitResultsView.xaml diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index d16792ead..95eb22d7a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -31,6 +31,7 @@ namespace Tango.PPC.UI.ViewModels { private JobHandler _jobHandler; private bool _resettingDevice; + private DispatcherTimer _date_timer; /// /// Gets or sets the module loader. @@ -219,6 +220,16 @@ namespace Tango.PPC.UI.ViewModels set { _cartridges = value; RaisePropertyChangedAuto(); } } + private DateTime _currentDateTime; + /// + /// Gets or sets the current date time. + /// + public DateTime CurrentDateTime + { + get { return _currentDateTime; } + set { _currentDateTime = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -306,6 +317,11 @@ namespace Tango.PPC.UI.ViewModels PowerOffCommand = new RelayCommand(PowerOffMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); ResetCommand = new RelayCommand(ResetMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); StandByCommand = new RelayCommand(StandBy, () => MachineProvider.MachineOperator.CanPrint); + + _date_timer = new DispatcherTimer(); + _date_timer.Interval = TimeSpan.FromSeconds(1); + _date_timer.Tick += _date_timer_Tick; + _date_timer.Start(); } #endregion @@ -614,6 +630,11 @@ namespace Tango.PPC.UI.ViewModels #region Event Handlers + private void _date_timer_Tick(object sender, EventArgs e) + { + CurrentDateTime = DateTime.Now; + } + /// /// Handles the PrintingStarted event of the MachineOperator. /// 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 b41dbb0bf..95db08dfa 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -194,7 +194,7 @@ namespace Tango.PPC.UI.ViewModels { StopCommand = new RelayCommand(StopJob, ()=>CanStopped()); AbortCommand = new RelayCommand(AbortJob, () => CanStopped()); - GoToJobCommand = new RelayCommand(GoToJob, () => CanStopped()); + GoToJobCommand = new RelayCommand(GoToJob); JobStatusViewCommand = new RelayCommand(JobStatusView); OverviewViewCommand = new RelayCommand(OverviewView); ClearAllNotificationsCommand = new RelayCommand(ClearAllNotifications); 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 092088ca6..d90ddd962 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml @@ -35,19 +35,19 @@ - + - - - + + + - - + + - + @@ -92,7 +92,7 @@ - + Power @@ -101,119 +101,77 @@ - - - - - - - - - - - + + + + + - - - - - - - + + + + + - Restart - --> - - - - + + + + + + + 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 e69f33514..9230f61c3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -18,6 +18,7 @@ +