aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs112
1 files changed, 112 insertions, 0 deletions
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;
+ /// <summary>
+ /// Gets or sets the index of the selected category.
+ /// </summary>
+ 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;
+ /// <summary>
+ /// Gets or sets the selected category.
+ /// </summary>
+ ///
+ public StatisticTab SelectedStatisticTab
+ {
+ get
+ {
+ return _selectedStatisticTab;
+ }
+ set
+ {
+ if (_selectedStatisticTab != value)
+ {
+ _selectedStatisticTab = value;
+ RaisePropertyChangedAuto();
+ }
+ _selectedStatisticTabIndex = _selectedStatisticTab.ToInt32();
+ RaisePropertyChanged(nameof(SelectedStatisticTabIndex));
+ }
+ }
+
+ public WpfGraphController<DateTimeDataPoint, DoubleDataPoint> 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<DateTimeDataPoint, DoubleDataPoint> CreateController(params WpfGraphDataSeries[] seriesCollection)
+ {
+ var controller = new WpfGraphController<DateTimeDataPoint, DoubleDataPoint>();
+
+ 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
}
}