From 3e46bf434c6f8ba56fe812205fd1ea20a1f9d347 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 5 Jun 2023 15:11:17 +0300 Subject: Present Lubricant Ink with divider, sort the Ink level indicators. Related Work Items: #8528 --- .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 29 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs') 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 68c0f1867..52199fcca 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -186,6 +186,13 @@ namespace Tango.PPC.UI.ViewModels set { _midTankLevels = value; RaisePropertyChangedAuto(); } } + private JerricanLevelModel _midTankLubLevel; + public JerricanLevelModel MidTankLubLevel + { + get { return _midTankLubLevel; } + set { _midTankLubLevel = value; RaisePropertyChangedAuto(); } + } + public MachineOverviewModel OverviewModel { get; set; } private bool _isDisplayJobOutline; @@ -264,11 +271,19 @@ namespace Tango.PPC.UI.ViewModels { base.OnApplicationReady(); - MidTankLevels = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.Where(x => x.MidTankType.HasLevelMeasure || x.MidTankType.Type == MidTankTypes.LubricantMidTank).OrderBy(x => x.PackIndex).Select(x => new JerricanLevelModel() + MidTankLevels = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.Where(x => x.MidTankType.HasLevelMeasure ).OrderBy(x => x.PackIndex).Select(x => new JerricanLevelModel() { Max = x.MidTankType.LiterCapacity, IDSPack = x, - }).OrderBy(y => y.IDSPack.LiquidType.PreferredIndex).ToList(); + }).OrderBy(y => y.IDSPack.LiquidType.Type).ToList(); + var LubLevel = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.Where(x => x.MidTankType.Type == MidTankTypes.LubricantMidTank).FirstOrDefault(); + + MidTankLubLevel = new JerricanLevelModel(); + if(LubLevel != null) + { + MidTankLubLevel.Max = LubLevel.MidTankType.LiterCapacity; + MidTankLubLevel.IDSPack = LubLevel; + }; MachineProvider.MachineOperator.MachineStatusChanged += MachineOperator_MachineStatusChanged; @@ -287,7 +302,15 @@ namespace Tango.PPC.UI.ViewModels { foreach (var item in status.IDSPacksLevels) { - var model = MidTankLevels.SingleOrDefault(x => x.IDSPack.PackIndex == item.Index); + JerricanLevelModel model = null; + if (item.Index == 8)//lub + { + model = MidTankLubLevel; + + } + else { + model = MidTankLevels.SingleOrDefault(x => x.IDSPack.PackIndex == item.Index); + } if (model != null) { -- cgit v1.3.1 From 54624e4a90a240ad702995e1ed551901768e131f Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 6 Jun 2023 14:56:59 +0300 Subject: Open Notifications bar when an error happens Related Work Items: #8534 --- .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 27 +++++++++++++++++++++- .../PPC/Tango.PPC.UI/Views/MachineStatusView.xaml | 12 ++++++---- .../Tango.Touch/Controls/TouchExpander.cs | 7 +++++- 3 files changed, 39 insertions(+), 7 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs') 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 52199fcca..2563cb331 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -217,6 +217,17 @@ namespace Tango.PPC.UI.ViewModels public MachineOverviewErrorStates MachineErrorStates { get; set; } + private bool _isExpandedNotificatios; + + public bool IsExpandedNotifications + { + get { return _isExpandedNotificatios; } + set { + _isExpandedNotificatios = value; + RaisePropertyChangedAuto();} + } + + #endregion #region Commands @@ -265,11 +276,14 @@ namespace Tango.PPC.UI.ViewModels OverviewModel = new MachineOverviewModel(); MachineErrorStates = new MachineOverviewErrorStates(); + + IsExpandedNotifications = false; } public override void OnApplicationReady() { base.OnApplicationReady(); + EventLogger.EventReceived += EventLogger_EventReceived; MidTankLevels = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.Where(x => x.MidTankType.HasLevelMeasure ).OrderBy(x => x.PackIndex).Select(x => new JerricanLevelModel() { @@ -291,7 +305,18 @@ namespace Tango.PPC.UI.ViewModels #region Events - private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status) + private void EventLogger_EventReceived(object sender, MachinesEvent ev) + { + InvokeUI(() => + { + if (ev.Category == EventTypeCategories.Error || ev.Category == EventTypeCategories.Critical) + { + IsExpandedNotifications = true; + } + }); + } + + private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status) { UpdateMidTankLevels(status); UpdateMachineStatusErrors(status); 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 1cdc39973..536682bf9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -1201,7 +1201,7 @@ - + @@ -1244,13 +1244,13 @@ - + - + @@ -1281,10 +1281,12 @@ - + + - + + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchExpander.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchExpander.cs index b85be6c49..80974bd4a 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchExpander.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchExpander.cs @@ -39,7 +39,12 @@ namespace Tango.Touch.Controls set { SetValue(IsExpandedProperty, value); } } public static readonly DependencyProperty IsExpandedProperty = - DependencyProperty.Register("IsExpanded", typeof(bool), typeof(TouchExpander), new PropertyMetadata(false)); + DependencyProperty.Register("IsExpanded", typeof(bool), typeof(TouchExpander), new FrameworkPropertyMetadata + { + DefaultValue = false, + BindsTwoWayByDefault = true, + DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged + }); static TouchExpander() { -- cgit v1.3.1 From a5de87ea9863c6e7053e09ed1c2eabf58285af48 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 20 Jun 2023 16:40:58 +0300 Subject: PPC. Added Real Time Graph --- Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml | 1 + .../StatisticTabToVisibilityConverter.cs | 28 ++++ .../PPC/Tango.PPC.UI/Graphs/GraphHelper.cs | 36 +++++ .../PPC/Tango.PPC.UI/Graphs/RealTimeGraph.cs | 149 +++++++++++++++++++++ .../PPC/Tango.PPC.UI/Graphs/RealTimeGraph.xaml | 106 +++++++++++++++ .../Tango.PPC.UI/Images/Overview Icons/motor.png | Bin 0 -> 1023 bytes .../Tango.PPC.UI/Images/Overview Icons/pr_data.png | Bin 0 -> 1054 bytes .../Images/Overview Icons/pressure.png | Bin 0 -> 1156 bytes .../Images/Overview Icons/temperature.png | Bin 0 -> 1065 bytes .../PPC/Tango.PPC.UI/Images/screw.png | Bin 0 -> 937 bytes .../PPC/Tango.PPC.UI/Resources/Graphs.xaml | 8 ++ .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 26 +++- .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 112 ++++++++++++++++ .../PPC/Tango.PPC.UI/Views/MachineStatusView.xaml | 64 +++++++++ .../Tango.PPC.UI/Views/MachineStatusView.xaml.cs | 10 ++ .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../Tango.Touch/Controls/TouchNavigationLinks.cs | 22 ++- .../Tango.Touch/Controls/TouchNavigationLinks.xaml | 5 +- .../Tango.Touch/Resources/Colors.xaml | 28 ++++ 19 files changed, 589 insertions(+), 8 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/StatisticTabToVisibilityConverter.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/GraphHelper.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/motor.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pr_data.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pressure.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/temperature.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/screw.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Graphs.xaml (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml index bdcf675e3..38a5b91b2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml @@ -20,6 +20,7 @@ + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/StatisticTabToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/StatisticTabToVisibilityConverter.cs new file mode 100644 index 000000000..06c75a999 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/StatisticTabToVisibilityConverter.cs @@ -0,0 +1,28 @@ +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; +using static Tango.PPC.UI.ViewModels.MachineStatusViewVM; + +namespace Tango.PPC.UI.Converters +{ + public class StatisticTabToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + StatisticTab selected = (StatisticTab)Enum.Parse(typeof(StatisticTab), parameter.ToString()); + StatisticTab statTab = (StatisticTab)value; + + return statTab.Equals(selected) ? Visibility.Visible : Visibility.Hidden; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/GraphHelper.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/GraphHelper.cs new file mode 100644 index 000000000..d06ed042a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/GraphHelper.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Media; + +namespace Tango.PPC.UI.Graphs +{ + public static class GraphHelper + { + public enum GraphColor + { + White, + Red, + Yellow, + Green, + Orange + } + + public static Color GetGraphColor(GraphColor graphColor) + { + return (Color)Application.Current.Resources[$"Tango_RealTimeGraph_{graphColor.ToString()}"]; + } + + public static Brush GetGraphBrush(GraphColor graphColor) + { + return new SolidColorBrush(GetGraphColor(graphColor)); + } + + public static Color GetGraphStrokeColor() + { + return (Color)Application.Current.Resources["Tango_RealTimeGraph_ForegroundColor"]; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.cs new file mode 100644 index 000000000..303b18892 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.cs @@ -0,0 +1,149 @@ +using RealTimeGraphX; +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; + +namespace Tango.PPC.UI.Graphs +{ + public class RealTimeGraph : Control + { + /// + /// Gets or sets the graph controller. + /// + public IGraphController Controller + { + get { return (IGraphController)GetValue(ControllerProperty); } + set { SetValue(ControllerProperty, value); } + } + public static readonly DependencyProperty ControllerProperty = + DependencyProperty.Register("Controller", typeof(IGraphController), typeof(RealTimeGraph), new PropertyMetadata(null)); + + + /// + /// Gets or sets the string format of the y-axis. + /// + public String StringFormat + { + get { return (String)GetValue(StringFormatProperty); } + set { SetValue(StringFormatProperty, value); } + } + public static readonly DependencyProperty StringFormatProperty = + DependencyProperty.Register("StringFormat", typeof(String), typeof(RealTimeGraph), new PropertyMetadata("0.0")); + + + /// + /// Gets or sets the display name. + /// + public String DisplayName + { + get { return (String)GetValue(DisplayNameProperty); } + set { SetValue(DisplayNameProperty, value); } + } + public static readonly DependencyProperty DisplayNameProperty = + DependencyProperty.Register("DisplayName", typeof(String), typeof(RealTimeGraph), new PropertyMetadata(null)); + + + /// + /// Gets or sets the display units. + /// + public String DisplayUnits + { + get { return (String)GetValue(DisplayUnitsProperty); } + set { SetValue(DisplayUnitsProperty, value); } + } + public static readonly DependencyProperty DisplayUnitsProperty = + DependencyProperty.Register("DisplayUnits", typeof(String), typeof(RealTimeGraph), new PropertyMetadata(null)); + + /// + /// Gets or sets the graph label visibility. + /// + public Visibility GraphLabelVisibility + { + get { return (Visibility)GetValue(GraphLabelVisibilityProperty); } + set { SetValue(GraphLabelVisibilityProperty, value); } + } + public static readonly DependencyProperty GraphLabelVisibilityProperty = + DependencyProperty.Register("GraphLabelVisibility", typeof(Visibility), typeof(RealTimeGraph), new PropertyMetadata(Visibility.Visible)); + + + /// + /// Gets or sets the vertical ticks. + /// + public int VerticalTicks + { + get { return (int)GetValue(VerticalTicksProperty); } + set { SetValue(VerticalTicksProperty, value); } + } + public static readonly DependencyProperty VerticalTicksProperty = + DependencyProperty.Register("VerticalTicks", typeof(int), typeof(RealTimeGraph), new PropertyMetadata(10)); + + + /// + /// Gets or sets the horizontal ticks. + /// + public int HorizontalTicks + { + get { return (int)GetValue(HorizontalTicksProperty); } + set { SetValue(HorizontalTicksProperty, value); } + } + public static readonly DependencyProperty HorizontalTicksProperty = + DependencyProperty.Register("HorizontalTicks", typeof(int), typeof(RealTimeGraph), new PropertyMetadata(10)); + + public Brush GridLinesBrush + { + get { return (Brush)GetValue(GridLinesBrushProperty); } + set { SetValue(GridLinesBrushProperty, value); } + } + public static readonly DependencyProperty GridLinesBrushProperty = + DependencyProperty.Register("GridLinesBrush", typeof(Brush), typeof(RealTimeGraph), new PropertyMetadata(null)); + + public Visibility HorizontalAxisVisibility + { + get { return (Visibility)GetValue(HorizontalAxisVisibilityProperty); } + set { SetValue(HorizontalAxisVisibilityProperty, value); } + } + public static readonly DependencyProperty HorizontalAxisVisibilityProperty = + DependencyProperty.Register("HorizontalAxisVisibility", typeof(Visibility), typeof(RealTimeGraph), new PropertyMetadata(Visibility.Visible)); + + public Visibility VerticalAxisVisibility + { + get { return (Visibility)GetValue(VerticalAxisVisibilityProperty); } + set { SetValue(VerticalAxisVisibilityProperty, value); } + } + public static readonly DependencyProperty VerticalAxisVisibilityProperty = + DependencyProperty.Register("VerticalAxisVisibility", typeof(Visibility), typeof(RealTimeGraph), new PropertyMetadata(Visibility.Visible)); + + public Visibility CurrentValueVisibility + { + get { return (Visibility)GetValue(CurrentValueVisibilityProperty); } + set { SetValue(CurrentValueVisibilityProperty, value); } + } + public static readonly DependencyProperty CurrentValueVisibilityProperty = + DependencyProperty.Register("CurrentValueVisibility", typeof(Visibility), typeof(RealTimeGraph), new PropertyMetadata(Visibility.Collapsed)); + + public double CurrentValueFontSize + { + get { return (double)GetValue(CurrentValueFontSizeProperty); } + set { SetValue(CurrentValueFontSizeProperty, value); } + } + public static readonly DependencyProperty CurrentValueFontSizeProperty = + DependencyProperty.Register("CurrentValueFontSize", typeof(double), typeof(RealTimeGraph), new PropertyMetadata(25.0)); + + public Thickness CurrentValueMargin + { + get { return (Thickness)GetValue(CurrentValueMarginProperty); } + set { SetValue(CurrentValueMarginProperty, value); } + } + public static readonly DependencyProperty CurrentValueMarginProperty = + DependencyProperty.Register("CurrentValueMargin", typeof(Thickness), typeof(RealTimeGraph), new PropertyMetadata(new Thickness(20))); + + /// + /// Initializes the class. + /// + static RealTimeGraph() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(RealTimeGraph), new FrameworkPropertyMetadata(typeof(RealTimeGraph))); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.xaml new file mode 100644 index 000000000..8844f9627 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.xaml @@ -0,0 +1,106 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/motor.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/motor.png new file mode 100644 index 000000000..8401a8e30 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/motor.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pr_data.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pr_data.png new file mode 100644 index 000000000..ebd02a99b Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pr_data.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pressure.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pressure.png new file mode 100644 index 000000000..12ade5d92 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pressure.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/temperature.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/temperature.png new file mode 100644 index 000000000..de9b042c4 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/temperature.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/screw.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/screw.png new file mode 100644 index 000000000..46a8134fe Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/screw.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Graphs.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Graphs.xaml new file mode 100644 index 000000000..67047cf1f --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Graphs.xaml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file 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 a3ec9667f..e2d447be5 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 @@ -176,6 +176,7 @@ + BitResultsView.xaml @@ -236,6 +237,8 @@ + + @@ -409,6 +412,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -433,6 +440,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -627,6 +638,11 @@ + + + + + @@ -648,6 +664,14 @@ + + {6b9774f7-960d-438e-ad81-c6b9be328d50} + RealTimeGraphX.WPF + + + {f13a489c-80ee-4cd0-bdd4-92d959215646} + RealTimeGraphX + {d129789c-3096-4d0b-8dd7-fe24a4df4b21} Tango.AnimatedGif @@ -964,7 +988,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 2563cb331..103084e11 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -20,11 +20,27 @@ using System.Timers; using System.Windows.Threading; using System.Diagnostics; using Tango.PMR.Printing; +using System.ComponentModel; +using RealTimeGraphX.WPF; +using RealTimeGraphX.DataPoints; +using Tango.PPC.UI.Graphs; namespace Tango.PPC.UI.ViewModels { public class MachineStatusViewVM : PPCViewModel { + public enum StatisticTab + { + [Description("Production Data")] + Productiondata = 0, + [Description("Temperature")] + Temperature = 1, + [Description("Pressure")] + Pressure = 2, + [Description("Motor")] + Motor = 3 + } + #region Properties [TangoInject] @@ -227,6 +243,70 @@ namespace Tango.PPC.UI.ViewModels RaisePropertyChangedAuto();} } + private int _selectedStatisticTabIndex; + /// + /// Gets or sets the index of the selected category. + /// + public int SelectedStatisticTabIndex + { + get { return _selectedStatisticTabIndex; } + set + { + if (_selectedStatisticTabIndex != value) + { + _selectedStatisticTabIndex = value; + RaisePropertyChangedAuto(); + switch (_selectedStatisticTabIndex) + { + case 0: + { + SelectedStatisticTab = StatisticTab.Productiondata; + break; + } + case 1: + { + SelectedStatisticTab = StatisticTab.Temperature; + break; + } + case 2: + { + SelectedStatisticTab = StatisticTab.Pressure; + break; + } + case 3: + { + SelectedStatisticTab = StatisticTab.Motor; + break; + } + } + } + } + } + + private StatisticTab _selectedStatisticTab; + /// + /// Gets or sets the selected category. + /// + /// + public StatisticTab SelectedStatisticTab + { + get + { + return _selectedStatisticTab; + } + set + { + if (_selectedStatisticTab != value) + { + _selectedStatisticTab = value; + RaisePropertyChangedAuto(); + } + _selectedStatisticTabIndex = _selectedStatisticTab.ToInt32(); + RaisePropertyChanged(nameof(SelectedStatisticTabIndex)); + } + } + + public WpfGraphController JobController { get; set; } #endregion @@ -278,6 +358,9 @@ namespace Tango.PPC.UI.ViewModels MachineErrorStates = new MachineOverviewErrorStates(); IsExpandedNotifications = false; + SelectedStatisticTabIndex = 0; + + JobController = CreateController(CreateSeries("Total", GraphHelper.GraphColor.Green)); } public override void OnApplicationReady() @@ -613,6 +696,35 @@ namespace Tango.PPC.UI.ViewModels } } + private WpfGraphController CreateController(params WpfGraphDataSeries[] seriesCollection) + { + var controller = new WpfGraphController(); + + foreach (var series in seriesCollection) + { + controller.DataSeriesCollection.Add(series); + } + + controller.Range.AutoY = true; + controller.Range.MaximumY = 100; + controller.Range.MinimumY = 0; + controller.Range.MaximumX = new DateTime(0).AddMinutes(30); + + controller.RefreshRate = TimeSpan.FromMilliseconds(300000);//5 min + + return controller; + } + + private WpfGraphDataSeries CreateSeries(String name, GraphHelper.GraphColor fill) + { + WpfGraphDataSeries series = new WpfGraphDataSeries(); + series.Name = name; + series.Fill = GraphHelper.GetGraphBrush(fill); + series.StrokeThickness = 1; + series.Stroke = GraphHelper.GetGraphStrokeColor(); + return series; + } + #endregion } } 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 1445337ad..9e766fffc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -12,6 +12,7 @@ xmlns:localConverters="clr-namespace:Tango.PPC.UI.Converters" xmlns:global="clr-namespace:Tango.PPC.UI" xmlns:models="clr-namespace:Tango.PPC.UI.Models" + xmlns:graphs="clr-namespace:Tango.PPC.UI.Graphs" 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}"> @@ -25,6 +26,7 @@ + + @@ -1203,6 +1209,64 @@ + + + + + + + + + + + + Production Data + + + + Temperature + + + + Pressure + + + + Motor + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs index 2ee98bc2b..e49e062b7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs @@ -57,5 +57,15 @@ namespace Tango.PPC.UI.Views { _timer.Stop(); } + + private void NavigationSTLinks_PreviewTouchDown(object sender, TouchEventArgs e) + { + e.Handled = true; + } + + private void NavigationSTLinks_PreviewMouseDown(object sender, MouseButtonEventArgs e) + { + e.Handled = true; + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.cs index 3a0d3de9e..5fb4496e0 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.cs @@ -24,7 +24,18 @@ namespace Tango.Touch.Controls private const string PART_Rectangle = "PART_Rectangle"; private Line _line; private Object _lastSelectedItem; + + public int LineThickness + { + get { return (int)GetValue(LineThicknessProperty); } + set { SetValue(LineThicknessProperty, value); } + } + + // Using a DependencyProperty as the backing store for LineThickness. This enables animation, styling, binding, etc... + public static readonly DependencyProperty LineThicknessProperty = + DependencyProperty.Register("LineThickness", typeof(int), typeof(TouchNavigationLinks), new PropertyMetadata(3)); + static TouchNavigationLinks() { DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchNavigationLinks), new FrameworkPropertyMetadata(typeof(TouchNavigationLinks))); @@ -48,12 +59,14 @@ namespace Tango.Touch.Controls private void MoveLineToSelectedItem() { - if (SelectedItem != null) + if (SelectedItem != null ) { + if(SelectedItem is UIElement && ((UIElement)SelectedItem).IsEnabled == false) + return; var container = ItemContainerGenerator.ContainerFromItem(SelectedItem) as FrameworkElement; - + ContentPresenter presenter = container.FindChild().FindChild(); - + if (presenter != null) { Point relativePoint = presenter.TransformToAncestor(this).Transform(new Point(0, 0)); @@ -87,8 +100,9 @@ namespace Tango.Touch.Controls _line.BeginAnimation(Line.X2Property, aniX2); } } + _lastSelectedItem = SelectedItem; } - + _lastSelectedItem = SelectedItem; } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.xaml index 599dfdf7c..2b8b4ff03 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.xaml @@ -37,10 +37,11 @@ + - + @@ -77,7 +78,7 @@ - + diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml index 283e69b45..1dc2090aa 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml @@ -60,6 +60,17 @@ #55FFFFFF #000131 + #18FFFFFF + #B6FF6F6F + #BBFFB84B + #B958C13B + #BBFA9252 + + #7C98B3 + #202020 + #505050 + #303030 + @@ -128,4 +139,21 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.3.1 From 38ed93f95bb5af92bc84599ebb9c0c6895b0b989 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 2 Jul 2023 13:37:17 +0300 Subject: Job running progress bar. Set running background in progress bar by unit from right to left as auto reverse ( not animation). Bug in current segment in JobHandler. --- .../Controls/RunningJobViewerEureka.xaml | 15 ++- .../Controls/RunningJobViewerEureka.xaml.cs | 108 ++++++++++++++++++++- .../Converters/DoubleWidthConverter.cs | 24 +++++ .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 1 + .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 10 +- .../PPC/Tango.PPC.UI/Views/MachineStatusView.xaml | 6 +- .../Tango.Integration/Operation/JobHandler.cs | 8 +- 7 files changed, 154 insertions(+), 18 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/DoubleWidthConverter.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml index 39c032145..4c39bded0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml @@ -4,12 +4,14 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:converters="clr-namespace:Tango.PPC.UI.Converters" xmlns:local="clr-namespace:Tango.PPC.UI.Controls" xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" mc:Ignorable="d" + Name="RunningJobViewerEurekaContr" d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=local:RunningJobViewerEureka, IsDesignTimeCreatable=False}"> - + + MouseDown="SliderContentControl_MouseDown" TouchDown="SliderContentControl_TouchDown" SizeChanged="Slider_control_SizeChanged" > @@ -34,7 +36,9 @@ - + + + @@ -45,7 +49,7 @@ - + @@ -55,7 +59,8 @@ - + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs index 29efaad72..95fe5cd10 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml.cs @@ -1,5 +1,8 @@ using System; +using System.Collections; using System.Collections.Generic; +using System.Collections.Specialized; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -22,6 +25,24 @@ namespace Tango.PPC.UI.Controls /// public partial class RunningJobViewerEureka : UserControl { + List _segments; + + + + private double _prevOffset; + private double _addOffset; + private int _prevUnit; + + private double _controlWidth; + + public double ControlWidth + { + get { return _controlWidth; } + set { + _controlWidth = value;//for debug + } + } + /// /// Maybe not necessary! /// @@ -43,7 +64,7 @@ namespace Tango.PPC.UI.Controls } public static readonly DependencyProperty DisplayMarkersProperty = DependencyProperty.Register("DisplayMarkers", typeof(bool), typeof(RunningJobViewerEureka), new PropertyMetadata(true)); - + /// /// Gets or sets the job. /// @@ -53,7 +74,40 @@ namespace Tango.PPC.UI.Controls set { SetValue(JobProperty, value); } } public static readonly DependencyProperty JobProperty = - DependencyProperty.Register("Job", typeof(Job), typeof(RunningJobViewerEureka), new PropertyMetadata(null)); + DependencyProperty.Register("Job", typeof(Job), typeof(RunningJobViewerEureka), new PropertyMetadata(null, (d, e) => (d as RunningJobViewerEureka).OnUpdateJob())); + + private void OnUpdateJob() + { + if(Job != null) + { + _segments = Job.EffectiveSegments.ToList(); + + if (Job.NumberOfUnits > 1 && _segments.Count > 0 + && (_segments.Count > 1 || _segments[0].BrushStops.Count > 1)) + { + //if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + //{ + // _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); + //} + _segments.AddRange(Job.EffectiveSegments.ToList()); + //if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + //{ + // _segments.Add(Job.CreateInterSegment(Job.InterSegmentLength)); + //}//without check if last segment and last unit + IsHasMultipleColorsSegments = true; + } + else + IsHasMultipleColorsSegments = false; + + SegmentsItemsControl.ItemsSource = _segments; + SegmentsItemsControl.InvalidateVisual(); + + _prevOffset = _addOffset = 0.0; + _prevUnit = 0; + ItemsBorder.SetValue(Canvas.LeftProperty, 0.0); + ItemsBorder.InvalidateVisual(); + } + } /// /// Gets or sets the running job status. @@ -121,7 +175,19 @@ namespace Tango.PPC.UI.Controls // Using a DependencyProperty as the backing store for ThumbHeight. This enables animation, styling, binding, etc... public static readonly DependencyProperty ThumbHeightProperty = DependencyProperty.Register("ThumbHeight", typeof(double), typeof(RunningJobViewerEureka), new FrameworkPropertyMetadata(0.0)); + + public bool IsHasMultipleColorsSegments + { + get { return (bool)GetValue(IsHasMultipleColorsSegmentsProperty); } + set { SetValue(IsHasMultipleColorsSegmentsProperty, value); } + } + + // Using a DependencyProperty as the backing store for IsHasMultipleColorsSegments. This enables animation, styling, binding, etc... + public static readonly DependencyProperty IsHasMultipleColorsSegmentsProperty = + DependencyProperty.Register("IsHasMultipleColorsSegments", typeof(bool), typeof(RunningJobViewerEureka), new PropertyMetadata(false)); + + /// /// Initializes a new instance of the class. /// @@ -139,11 +205,49 @@ namespace Tango.PPC.UI.Controls { e.Handled = true; } + private void OnSliderValueChanged() { if(slider_control != null) + { slider_control.Value = SliderValue; + if(RunningJobStatus != null && RunningJobStatus.IsSettingUp == false && IsHasMultipleColorsSegments && ColorCanvas != null && ControlWidth > 0) + { + double progress = RunningJobStatus.CurrentUnitProgress; + double total = RunningJobStatus.CurrentUnitTotalProgress; + + int currentUnit = RunningJobStatus.CurrentUnit; + int totalUnits = Job.NumberOfUnits; + + double simpleoffset = ((progress / total) * ControlWidth) ; + + double multiplier = (((double)(totalUnits - 1)) / (double)totalUnits); + double offset = simpleoffset * multiplier; + + if(_prevUnit < currentUnit) + { + _addOffset = _prevOffset; + } + + offset += _addOffset; + + if (offset >= ControlWidth) + { + offset -= ControlWidth;//round + } + _prevOffset = offset; + _prevUnit = currentUnit; + + ItemsBorder.SetValue(Canvas.LeftProperty, (-1) * offset); + ItemsBorder.InvalidateVisual(); + } + } + } + + private void Slider_control_SizeChanged(object sender, SizeChangedEventArgs e) + { + ControlWidth = e.NewSize.Width; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/DoubleWidthConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/DoubleWidthConverter.cs new file mode 100644 index 000000000..3ddcc5f3c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/DoubleWidthConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.PPC.UI.Converters +{ + public class DoubleWidthConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + double length = System.Convert.ToDouble(value); + return length * 2; + } + + public object ConvertBack(object value, Type targetType, 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 e2d447be5..f5d3502c0 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 @@ -168,6 +168,7 @@ + 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 103084e11..653c2368f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -571,17 +571,17 @@ namespace Tango.PPC.UI.ViewModels IsDyeingProcess = (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null); if (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null) { - var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == _runningJobStatus.CurrentSegment.SegmentIndex); + var currentSegmentIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0); + var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == currentSegmentIndex); + // var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == _runningJobStatus.CurrentSegment.SegmentIndex); if (segment != null) { - if (_handler.JobTicket.Segments.Count > 0) { JobBrushStop = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)].BrushStops.First(); - } - - CurrentBrushStop = segment.FirstBrushStop; + } } + CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; } } 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 9e766fffc..614da8fea 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -607,7 +607,7 @@ - + @@ -1260,9 +1260,9 @@ - + - diff --git a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs index 23bd2b1ba..4579ff08c 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/JobHandler.cs @@ -516,7 +516,8 @@ namespace Tango.Integration.Operation TimeSpan segmentsDuration = Job.TranslateProgressToTime(previousSegmentsLengthWithThis, ProcessParameters); TimeSpan segmentRemainingTime = segmentsDuration - Job.TranslateProgressToTime(Status.Progress, ProcessParameters); - segment.Progress = Math.Min(Math.Max((previousSegmentsLengthWithThis - segment.Length - Status.Progress) * -1, 0), segment.Length); + // segment.Progress = Math.Min(Math.Max((previousSegmentsLengthWithThis - segment.Length - Status.Progress) * -1, 0), segment.Length); + segment.Progress = Math.Min(Math.Max((previousSegmentsLengthWithThis - segment.Length - Status.ProgressMinusSettingUp) * -1, 0), segment.Length); if (i == 0 && Status.Progress > 0) { @@ -526,8 +527,9 @@ namespace Tango.Integration.Operation Status.CurrentSegment = segment; } } - - if (Status.Progress >= previousSegmentsLengthWithThis) + + //if (Status.Progress >= previousSegmentsLengthWithThis) + if (Status.ProgressMinusSettingUp >= previousSegmentsLengthWithThis) { if (!segment.Completed) { -- cgit v1.3.1