From 11e64f69d00d84974bb09bef6f921c7eeab7c47e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 24 Jan 2018 18:30:53 +0200 Subject: Added Graphs Drag & Drop to Developer Module. --- .../Controls/RealTimeGraphControl.xaml.cs | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs new file mode 100644 index 000000000..6396ab91a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Common.Controls +{ + /// + /// Interaction logic for RealTimeGraphControl.xaml + /// + public partial class RealTimeGraphControl : UserControl + { + #region Properties + + /// + /// Gets or sets the name of the sensor. + /// + public String SensorName + { + get { return (String)GetValue(SensorNameProperty); } + set { SetValue(SensorNameProperty, value); } + } + public static readonly DependencyProperty SensorNameProperty = + DependencyProperty.Register("SensorName", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null)); + + /// + /// Gets or sets the sensor units. + /// + public String SensorUnits + { + get { return (String)GetValue(SensorUnitsProperty); } + set { SetValue(SensorUnitsProperty, value); } + } + public static readonly DependencyProperty SensorUnitsProperty = + DependencyProperty.Register("SensorUnits", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null)); + + + #endregion + + #region Events + + public event EventHandler GraphRemoveButtonPressed; + public event EventHandler GraphFullScreenButtonPressed; + + #endregion + + public RealTimeGraphControl() + { + InitializeComponent(); + } + + private void OnGraphFullScreen(object sender, RoutedEventArgs e) + { + GraphFullScreenButtonPressed?.Invoke(this, new EventArgs()); + } + + private void Graph_MouseEnter(object sender, MouseEventArgs e) + { + Grid mainGrid = sender as Grid; + var headerGrid = mainGrid.Children.OfType().ToList().First(); + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, 0, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } + + private void Graph_MouseLeave(object sender, MouseEventArgs e) + { + Grid mainGrid = sender as Grid; + var headerGrid = mainGrid.Children.OfType().ToList().First(); + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, -35, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } + + private void OnGraphRemove(object sender, RoutedEventArgs e) + { + GraphRemoveButtonPressed?.Invoke(this, new EventArgs()); + } + } +} -- cgit v1.3.1 From d36a5ab7115ec53405622e4437cd3f8f615d515d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 24 Jan 2018 19:32:14 +0200 Subject: Added support for multi sensor frame on developer module graph. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../ViewModels/MainViewVM.cs | 44 +++++++-- .../Controls/IRealTimeGraph.cs | 48 +++++++++ .../Controls/RealTimeGraphControl.xaml | 2 +- .../Controls/RealTimeGraphControl.xaml.cs | 15 ++- .../Controls/RealTimeGraphMultiControl.xaml | 95 ++++++++++++++++++ .../Controls/RealTimeGraphMultiControl.xaml.cs | 107 +++++++++++++++++++++ .../Resources/MaterialDesign.xaml | 40 ++++++++ .../Tango.MachineStudio.Common.csproj | 8 ++ .../FastGraphs/RealTimeGraphExLineScroll.cs | 12 --- .../RealTimeGraphEx/RealTimeGraphExBase.cs | 11 +++ .../RealTimeGraphEx/RealTimeGraphExMultiBase.cs | 12 --- .../Tango.Core/Helpers/ColorHelper.cs | 11 +++ 14 files changed, 370 insertions(+), 35 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 27da03f9b..875b88771 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index bdff96627..3a65c84fa 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 590474f9d..dc3ba0ec5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1,10 +1,13 @@ using GalaSoft.MvvmLight.Ioc; +using RealTimeGraphEx.Controllers; +using RealTimeGraphEx.DataSeries; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Media; using Tango.Core.Commands; using Tango.DAL.Observables; using Tango.MachineStudio.Common.Controls; @@ -124,11 +127,11 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _availableSensors = value; RaisePropertyChangedAuto(); } } - private ObservableCollection _graphs; + private ObservableCollection _graphs; /// /// Gets or sets the collection of displayed graph controls. /// - public ObservableCollection Graphs + public ObservableCollection Graphs { get { return _graphs; } set { _graphs = value; RaisePropertyChangedAuto(); } @@ -180,7 +183,7 @@ namespace Tango.MachineStudio.Developer.ViewModels AvailableSensors = Adapter.Sensors.ToObservableCollection(); } - Graphs = new ObservableCollection(); + Graphs = new ObservableCollection(); } /// @@ -338,16 +341,39 @@ namespace Tango.MachineStudio.Developer.ViewModels { if (Graphs.Count < 8) { - RealTimeGraphControl graphControl = new RealTimeGraphControl(); + IRealTimeGraph graphControl = null; + + if (!sensor.MultiChannel) + { + graphControl = new RealTimeGraphControl(); + } + else + { + graphControl = new RealTimeGraphMultiControl(); + GraphMultiController controller = new GraphMultiController(); + + for (int i = 0; i < sensor.ChannelCount; i++) + { + controller.AddSeries(new DataYSeries() + { + Name = sensor.Description.First().ToString() + (i + 1), + UseFillAndStroke = true, + Stroke = new SolidColorBrush(Core.Helpers.ColorHelper.GetRandomColor()) + }); + } + + graphControl.Controller = controller; + } + graphControl.Tag = sensor; graphControl.SensorName = sensor.Description; graphControl.SensorUnits = sensor.Units; - graphControl.Graph.Minimum = sensor.Min; - graphControl.Graph.Maximum = sensor.Max; - graphControl.Graph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(sensor.PointsPerFrame); + graphControl.InnerGraph.Minimum = sensor.Min; + graphControl.InnerGraph.Maximum = sensor.Max; + graphControl.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(sensor.PointsPerFrame); graphControl.GraphRemoveButtonPressed += (sender, __) => { - RemoveGraph(sender as RealTimeGraphControl); + RemoveGraph(sender as IRealTimeGraph); }; Graphs.Add(graphControl); AvailableSensors.Remove(sensor); @@ -362,7 +388,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Removes the graph. /// /// The graph. - public void RemoveGraph(RealTimeGraphControl graph) + public void RemoveGraph(IRealTimeGraph graph) { Graphs.Remove(graph); AvailableSensors.Insert(0, graph.Tag as Sensor); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs new file mode 100644 index 000000000..5ca930c91 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs @@ -0,0 +1,48 @@ +using RealTimeGraphEx; +using RealTimeGraphEx.Controllers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.Controls +{ + public interface IRealTimeGraph + { + /// + /// Gets or sets the name of the sensor. + /// + String SensorName { get; set; } + + /// + /// Gets or sets the tag. + /// + Object Tag { get; set; } + + /// + /// Gets or sets the sensor units. + /// + String SensorUnits { get; set; } + + /// + /// Occurs when the graph remove button has been pressed. + /// + event EventHandler GraphRemoveButtonPressed; + + /// + /// Occurs when the graph full screen button has been pressed. + /// + event EventHandler GraphFullScreenButtonPressed; + + /// + /// Gets or sets the inner real-time graph control. + /// + RealTimeGraphExBase InnerGraph { get; set; } + + /// + /// Gets or sets the inner graph controller. + /// + GraphControllerBase Controller { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml index 687bc6030..449cea493 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml @@ -67,7 +67,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs index 6396ab91a..359e52823 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs @@ -14,13 +14,15 @@ using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using RealTimeGraphEx; +using RealTimeGraphEx.Controllers; namespace Tango.MachineStudio.Common.Controls { /// /// Interaction logic for RealTimeGraphControl.xaml /// - public partial class RealTimeGraphControl : UserControl + public partial class RealTimeGraphControl : UserControl, IRealTimeGraph { #region Properties @@ -46,6 +48,15 @@ namespace Tango.MachineStudio.Common.Controls public static readonly DependencyProperty SensorUnitsProperty = DependencyProperty.Register("SensorUnits", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null)); + /// + /// Gets or sets the inner real-time graph control. + /// + public RealTimeGraphExBase InnerGraph { get; set; } + + /// + /// Gets or sets the inner graph controller. + /// + public GraphControllerBase Controller { get; set; } #endregion @@ -59,6 +70,8 @@ namespace Tango.MachineStudio.Common.Controls public RealTimeGraphControl() { InitializeComponent(); + InnerGraph = Graph; + Controller = new GraphController(); } private void OnGraphFullScreen(object sender, RoutedEventArgs e) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml new file mode 100644 index 000000000..23573e574 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs new file mode 100644 index 000000000..5cb69b786 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs @@ -0,0 +1,107 @@ +using RealTimeGraphEx; +using RealTimeGraphEx.Controllers; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Common.Controls +{ + /// + /// Interaction logic for RealTimeGraphControl.xaml + /// + public partial class RealTimeGraphMultiControl : UserControl , IRealTimeGraph + { + #region Properties + + /// + /// Gets or sets the name of the sensor. + /// + public String SensorName + { + get { return (String)GetValue(SensorNameProperty); } + set { SetValue(SensorNameProperty, value); } + } + public static readonly DependencyProperty SensorNameProperty = + DependencyProperty.Register("SensorName", typeof(String), typeof(RealTimeGraphMultiControl), new PropertyMetadata(null)); + + /// + /// Gets or sets the sensor units. + /// + public String SensorUnits + { + get { return (String)GetValue(SensorUnitsProperty); } + set { SetValue(SensorUnitsProperty, value); } + } + public static readonly DependencyProperty SensorUnitsProperty = + DependencyProperty.Register("SensorUnits", typeof(String), typeof(RealTimeGraphMultiControl), new PropertyMetadata(null)); + + /// + /// Gets or sets the inner real-time graph control. + /// + public RealTimeGraphExBase InnerGraph { get; set; } + + /// + /// Gets or sets the inner graph controller. + /// + public GraphControllerBase Controller { get; set; } + + #endregion + + #region Events + + public event EventHandler GraphRemoveButtonPressed; + public event EventHandler GraphFullScreenButtonPressed; + + #endregion + + public RealTimeGraphMultiControl() + { + InitializeComponent(); + InnerGraph = Graph; + Controller = new GraphMultiController(); + } + + private void OnGraphFullScreen(object sender, RoutedEventArgs e) + { + GraphFullScreenButtonPressed?.Invoke(this, new EventArgs()); + } + + private void Graph_MouseEnter(object sender, MouseEventArgs e) + { + Grid mainGrid = sender as Grid; + var headerGrid = mainGrid.Children.OfType().ToList().First(); + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, 0, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } + + private void Graph_MouseLeave(object sender, MouseEventArgs e) + { + Grid mainGrid = sender as Grid; + var headerGrid = mainGrid.Children.OfType().ToList().First(); + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, -35, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } + + private void OnGraphRemove(object sender, RoutedEventArgs e) + { + GraphRemoveButtonPressed?.Invoke(this, new EventArgs()); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index cc18c31c5..8c5464930 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -267,6 +267,46 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index b89ec2e09..bc7f00d58 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -71,6 +71,10 @@ + + + RealTimeGraphMultiControl.xaml + RealTimeGraphControl.xaml @@ -103,6 +107,10 @@ + + MSBuild:Compile + Designer + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs index 216683d39..a2260030c 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs @@ -40,18 +40,6 @@ namespace RealTimeGraphEx.FastGraphs #region Properties - /// - /// Gets or sets the maximum vectorsCollection to display on the graph (default 1000, affects performance). - /// - public int MaxPoints - { - get { return (int)GetValue(MaxPointsProperty); } - set { SetValue(MaxPointsProperty, value); } - } - public static readonly DependencyProperty MaxPointsProperty = - DependencyProperty.Register("MaxPoints", typeof(int), typeof(RealTimeGraphExLineScroll), new PropertyMetadata(1000, new PropertyChangedCallback(CrossModelChanged))); - - /// /// Gets or sets the graph fill color. /// diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs index cf8d6c0fe..c1ed37474 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs @@ -349,6 +349,17 @@ namespace RealTimeGraphEx public static readonly DependencyProperty ZoomDirectionProperty = DependencyProperty.Register("ZoomDirection", typeof(ZoomDirectionEnum), typeof(RealTimeGraphExBase), new PropertyMetadata(ZoomDirectionEnum.Both)); + /// + /// Gets or sets the maximum points to display on the graph (default 1000). + /// + public int MaxPoints + { + get { return (int)GetValue(MaxPointsProperty); } + set { SetValue(MaxPointsProperty, value); } + } + public static readonly DependencyProperty MaxPointsProperty = + DependencyProperty.Register("MaxPoints", typeof(int), typeof(RealTimeGraphExBase), new PropertyMetadata(1000, new PropertyChangedCallback(CrossModelChanged))); + #endregion #region Cross Thread Fields diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExMultiBase.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExMultiBase.cs index d9edc478e..108ff4ea3 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExMultiBase.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExMultiBase.cs @@ -22,18 +22,6 @@ namespace RealTimeGraphEx #region Properties - /// - /// Gets or sets the maximum points to display on the graph (default 1000). - /// - public int MaxPoints - { - get { return (int)GetValue(MaxPointsProperty); } - set { SetValue(MaxPointsProperty, value); } - } - public static readonly DependencyProperty MaxPointsProperty = - DependencyProperty.Register("MaxPoints", typeof(int), typeof(RealTimeGraphExMultiBase), new PropertyMetadata(1000, new PropertyChangedCallback(CrossModelChanged))); - - /// /// Gets or sets the collection of data series to display on the graph. /// diff --git a/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs index c5ebc7474..3d0532985 100644 --- a/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs +++ b/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs @@ -12,6 +12,8 @@ namespace Tango.Core.Helpers /// public static class ColorHelper { + private static Random rnd = new Random(); + /// /// Converts the specified color to integer. /// @@ -36,5 +38,14 @@ namespace Tango.Core.Helpers byte b = (byte)(integer >> 0); return Color.FromArgb(a, r, g, b); } + + /// + /// Returns a random color. + /// + /// + public static Color GetRandomColor() + { + return Color.FromRgb((byte)rnd.Next(256), (byte)rnd.Next(256), (byte)rnd.Next(256)); + } } } -- cgit v1.3.1 From ffba68ef988743f3b70f3cd85fa16eab2abc7030 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 4 Feb 2018 09:04:55 +0200 Subject: Modified video frame. Modified developer module configuration design. Implemented graph full-screen. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes Software/Graphics/video-frame.png | Bin 107600 -> 97254 bytes .../Images/video-frame.png | Bin 107600 -> 97254 bytes .../ViewModels/MainViewVM.cs | 51 ++++- .../Views/MainView.xaml | 212 ++++++++++++++------- .../Controls/IRealTimeGraph.cs | 5 + .../Controls/RealTimeGraphControl.xaml.cs | 47 ++++- .../Controls/RealTimeGraphMultiControl.xaml.cs | 44 ++++- .../Converters/NullObjectToBooleanConverter.cs | 3 +- 10 files changed, 279 insertions(+), 83 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 1d7afd781..e7bc76403 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index bacb454a8..90a1e6eb3 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/video-frame.png b/Software/Graphics/video-frame.png index a052b62cf..9c29dc438 100644 Binary files a/Software/Graphics/video-frame.png and b/Software/Graphics/video-frame.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png index a052b62cf..9c29dc438 100644 Binary files a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/video-frame.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 08b8897d2..1d0a52baf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -23,6 +23,8 @@ using Tango.Integration.Operators; using Tango.PMR.Diagnostics; using System.Reflection; using Tango.PMR.Common; +using Tango.SharedUI.Helpers; +using Tango.Transport; namespace Tango.MachineStudio.Developer.ViewModels { @@ -35,6 +37,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private INotificationProvider _notification; private TimeSpan _runningJobEstimatedDuration; private Dictionary _controllers; + private int _fullScreenGraphIndex; #region Properties @@ -307,6 +310,16 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _machineOperator = value; RaisePropertyChangedAuto(); } } + private IRealTimeGraph _fullScreenGraph; + /// + /// Gets or sets the full screen graph. + /// + public IRealTimeGraph FullScreenGraph + { + get { return _fullScreenGraph; } + set { _fullScreenGraph = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -391,6 +404,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public RelayCommand ToggleCameraCommand { get; set; } + /// + /// Gets or sets the exit full screen command. + /// + public RelayCommand ExitFullScreenCommand { get; set; } + #endregion #region Constructors @@ -439,6 +457,7 @@ namespace Tango.MachineStudio.Developer.ViewModels StartJobCommand = new RelayCommand(StartJob, () => SelectedJob != null && !IsJobRunning); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); + ExitFullScreenCommand = new RelayCommand(ExitFullScreen); CaptureDevices = new ObservableCollection(); var availableDevices = CaptureDevice.GetAvailableCaptureDevices(); @@ -605,6 +624,24 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private void ExitFullScreen() + { + if (FullScreenGraph != null) + { + FullScreenGraph.EnableToolBar = true; + Graphs.Insert(_fullScreenGraphIndex, FullScreenGraph); + FullScreenGraph = null; + } + } + + private void StartFullScreenGraph(IRealTimeGraph graph) + { + graph.EnableToolBar = false; + _fullScreenGraphIndex = Graphs.IndexOf(graph); + Graphs.Remove(graph); + FullScreenGraph = graph; + } + private void ToggleCamera(CaptureDevice captureDevice) { if (captureDevice.Device != null) @@ -636,6 +673,12 @@ namespace Tango.MachineStudio.Developer.ViewModels private void StartJob() { + if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected) + { + _notification.ShowError("No machine connected. Could not execute the specified job."); + return; + } + RunningJobRemainingTime = TimeSpan.Zero; RunningJobProgress = 0; IsJobFailed = false; @@ -887,7 +930,7 @@ namespace Tango.MachineStudio.Developer.ViewModels #endregion - #region Public Events + #region Public Methods /// /// Add sensor graph from available sensors to displayed graphs. @@ -932,10 +975,14 @@ namespace Tango.MachineStudio.Developer.ViewModels graphControl.InnerGraph.Minimum = sensor.Min; graphControl.InnerGraph.Maximum = sensor.Max; graphControl.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(sensor.PointsPerFrame); - graphControl.GraphRemoveButtonPressed += (sender, __) => + graphControl.GraphRemoveButtonPressed += (sender, _) => { RemoveGraph(sender as IRealTimeGraph); }; + graphControl.GraphFullScreenButtonPressed += (sender, _) => + { + StartFullScreenGraph(sender as IRealTimeGraph); + }; Graphs.Add(graphControl); AvailableSensors.Remove(sensor); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 65837bcf1..196b20157 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -8,6 +8,7 @@ xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views.DBViews;assembly=Tango.MachineStudio.DB" xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner" @@ -22,6 +23,10 @@ mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="White" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + + + + + @@ -488,7 +495,7 @@ - + - - - - - - Job Status - - - - - - - - - - - - - - - - - - - - - @@ -1562,7 +1524,7 @@ - + @@ -1741,11 +1703,76 @@ - Show Graphs + Display Graphs + + + + + + + + + + + + + Job Status + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Press + 'Escape' + to exit full screen mode + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs index 5ca930c91..bf40d459e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs @@ -44,5 +44,10 @@ namespace Tango.MachineStudio.Common.Controls /// Gets or sets the inner graph controller. /// GraphControllerBase Controller { get; set; } + + /// + /// Gets or sets a value indicating whether to enable toolbar buttons. + /// + bool EnableToolBar { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs index 359e52823..c1728a975 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs @@ -24,6 +24,8 @@ namespace Tango.MachineStudio.Common.Controls /// public partial class RealTimeGraphControl : UserControl, IRealTimeGraph { + private Grid headerGrid; + #region Properties /// @@ -58,6 +60,32 @@ namespace Tango.MachineStudio.Common.Controls /// public GraphControllerBase Controller { get; set; } + + private bool _enableToolbar; + /// + /// Gets or sets a value indicating whether to enable toolbar buttons. + /// + public bool EnableToolBar + { + get { return _enableToolbar; } + set + { + _enableToolbar = value; + + if (!value) + { + if (headerGrid != null) + { + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, -35, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } + } + } + } + + #endregion #region Events @@ -70,6 +98,7 @@ namespace Tango.MachineStudio.Common.Controls public RealTimeGraphControl() { InitializeComponent(); + EnableToolBar = true; InnerGraph = Graph; Controller = new GraphController(); } @@ -81,18 +110,21 @@ namespace Tango.MachineStudio.Common.Controls private void Graph_MouseEnter(object sender, MouseEventArgs e) { - Grid mainGrid = sender as Grid; - var headerGrid = mainGrid.Children.OfType().ToList().First(); - ThicknessAnimation ani = new ThicknessAnimation(); - ani.To = new Thickness(0, 0, 0, 0); - ani.Duration = TimeSpan.FromSeconds(0.2); - headerGrid.BeginAnimation(Grid.MarginProperty, ani); + if (EnableToolBar) + { + Grid mainGrid = sender as Grid; + headerGrid = mainGrid.Children.OfType().ToList().First(); + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, 0, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } } private void Graph_MouseLeave(object sender, MouseEventArgs e) { Grid mainGrid = sender as Grid; - var headerGrid = mainGrid.Children.OfType().ToList().First(); + headerGrid = mainGrid.Children.OfType().ToList().First(); ThicknessAnimation ani = new ThicknessAnimation(); ani.To = new Thickness(0, -35, 0, 0); ani.Duration = TimeSpan.FromSeconds(0.2); @@ -103,5 +135,6 @@ namespace Tango.MachineStudio.Common.Controls { GraphRemoveButtonPressed?.Invoke(this, new EventArgs()); } + } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs index 5cb69b786..a18021ff5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs @@ -24,6 +24,8 @@ namespace Tango.MachineStudio.Common.Controls /// public partial class RealTimeGraphMultiControl : UserControl , IRealTimeGraph { + private Grid headerGrid; + #region Properties /// @@ -58,6 +60,30 @@ namespace Tango.MachineStudio.Common.Controls /// public GraphControllerBase Controller { get; set; } + private bool _enableToolbar; + /// + /// Gets or sets a value indicating whether to enable toolbar buttons. + /// + public bool EnableToolBar + { + get { return _enableToolbar; } + set + { + _enableToolbar = value; + + if (!value) + { + if (headerGrid != null) + { + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, -35, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } + } + } + } + #endregion #region Events @@ -70,6 +96,7 @@ namespace Tango.MachineStudio.Common.Controls public RealTimeGraphMultiControl() { InitializeComponent(); + EnableToolBar = true; InnerGraph = Graph; Controller = new GraphMultiController(); } @@ -81,18 +108,21 @@ namespace Tango.MachineStudio.Common.Controls private void Graph_MouseEnter(object sender, MouseEventArgs e) { - Grid mainGrid = sender as Grid; - var headerGrid = mainGrid.Children.OfType().ToList().First(); - ThicknessAnimation ani = new ThicknessAnimation(); - ani.To = new Thickness(0, 0, 0, 0); - ani.Duration = TimeSpan.FromSeconds(0.2); - headerGrid.BeginAnimation(Grid.MarginProperty, ani); + if (EnableToolBar) + { + Grid mainGrid = sender as Grid; + headerGrid = mainGrid.Children.OfType().ToList().First(); + ThicknessAnimation ani = new ThicknessAnimation(); + ani.To = new Thickness(0, 0, 0, 0); + ani.Duration = TimeSpan.FromSeconds(0.2); + headerGrid.BeginAnimation(Grid.MarginProperty, ani); + } } private void Graph_MouseLeave(object sender, MouseEventArgs e) { Grid mainGrid = sender as Grid; - var headerGrid = mainGrid.Children.OfType().ToList().First(); + headerGrid = mainGrid.Children.OfType().ToList().First(); ThicknessAnimation ani = new ThicknessAnimation(); ani.To = new Thickness(0, -35, 0, 0); ani.Duration = TimeSpan.FromSeconds(0.2); diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanConverter.cs index 5046ee127..1f65bc87a 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanConverter.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/NullObjectToBooleanConverter.cs @@ -24,8 +24,7 @@ namespace Tango.SharedUI.Converters /// public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - if (value != null) return true; - return false; + return (value != null); } /// -- cgit v1.3.1 From 6103db0f792e396583929c08117e07fb6b9aa389 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 8 Feb 2018 19:22:42 +0200 Subject: Working on MachineTechView... --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes Software/Graphics/analog.png | Bin 0 -> 7334 bytes Software/Graphics/graph.png | Bin 0 -> 1842 bytes Software/Graphics/single-graph.png | Bin 0 -> 4236 bytes .../Diagnostics/PushDiagnosticsResponse.proto | 12 ++ .../MonitorsToSingleChannleMonitorsConverter.cs | 34 ++++ .../Editors/MonitorElementEditor.xaml | 2 +- .../Editors/MonitorElementEditor.xaml.cs | 27 +-- .../Editors/SingleGraphElementEditor.xaml | 79 +++++++++ .../Editors/SingleGraphElementEditor.xaml.cs | 102 +++++++++++ .../Images/analog.png | Bin 0 -> 7334 bytes .../Images/graph.png | Bin 0 -> 1842 bytes .../Images/single-graph.png | Bin 0 -> 4236 bytes .../Items/MonitorItem.cs | 43 ----- .../Items/TechItem.cs | 99 ----------- .../PropertiesTemplates/MonitorTemplate.xaml | 22 +++ .../PropertiesTemplates/MonitorTemplate.xaml.cs | 28 +++ .../PropertiesTemplates/SingleGraphTemplate.xaml | 22 +++ .../SingleGraphTemplate.xaml.cs | 29 ++++ .../Tango.MachineStudio.Technician.csproj | 36 +++- .../TechItems/MonitorItem.cs | 51 ++++++ .../TechItems/SingleGraphItem.cs | 60 +++++++ .../TechItems/TechItem.cs | 138 +++++++++++++++ .../TechnicianModule.cs | 2 +- .../ViewModels/MachineTechViewVM.cs | 153 ++++++++++++++++- .../Views/MachineTechView.xaml | 94 ++++++++++- .../Controls/RealTimeGraphControl.xaml | 6 +- .../Controls/RealTimeGraphControl.xaml.cs | 29 ++++ .../RealTimeGraphEx/RealTimeGraphExBase.cs | 11 +- .../Tango.Emulations/Emulators/MachineEmulator.cs | 9 + .../Diagnostics/PushDiagnosticsResponse.cs | 188 ++++++++++++++++++++- 32 files changed, 1083 insertions(+), 193 deletions(-) create mode 100644 Software/Graphics/analog.png create mode 100644 Software/Graphics/graph.png create mode 100644 Software/Graphics/single-graph.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/MonitorsToSingleChannleMonitorsConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/analog.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/graph.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/single-graph.png delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/MonitorItem.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/TechItem.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 1f3e96a4c..8f36c9d40 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index d64502c82..29ebe00a1 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/analog.png b/Software/Graphics/analog.png new file mode 100644 index 000000000..2651a64b0 Binary files /dev/null and b/Software/Graphics/analog.png differ diff --git a/Software/Graphics/graph.png b/Software/Graphics/graph.png new file mode 100644 index 000000000..0aca05e00 Binary files /dev/null and b/Software/Graphics/graph.png differ diff --git a/Software/Graphics/single-graph.png b/Software/Graphics/single-graph.png new file mode 100644 index 000000000..f72f56a87 Binary files /dev/null and b/Software/Graphics/single-graph.png differ diff --git a/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto b/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto index 340a636df..e45cb3040 100644 --- a/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto +++ b/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto @@ -10,5 +10,17 @@ message PushDiagnosticsResponse repeated double Dancer1Angle = 1; repeated double Dancer2Angle = 2; repeated double Dancer3Angle = 3; + + //Dispensers Motors Frequency Multi repeated DoubleArray DispensersMotorsFrequency = 4; + + //Dispensers Motors Frequency Singles + repeated double Dispenser1MotorFrequency = 5; + repeated double Dispenser2MotorFrequency = 6; + repeated double Dispenser3MotorFrequency = 7; + repeated double Dispenser4MotorFrequency = 8; + repeated double Dispenser5MotorFrequency = 9; + repeated double Dispenser6MotorFrequency = 10; + repeated double Dispenser7MotorFrequency = 11; + repeated double Dispenser8MotorFrequency = 12; } \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/MonitorsToSingleChannleMonitorsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/MonitorsToSingleChannleMonitorsConverter.cs new file mode 100644 index 000000000..b5f9cffef --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/MonitorsToSingleChannleMonitorsConverter.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Technician.Converters +{ + public class MonitorsToSingleChannleMonitorsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + ObservableCollection monitors = value as ObservableCollection; + + if (monitors != null) + { + return monitors.Where(x => !x.MultiChannel).ToObservableCollection(); + } + else + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml index d3ce4fc10..84eae5f75 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml @@ -33,7 +33,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml.cs index f50fc9039..c11ca4417 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml.cs @@ -17,35 +17,10 @@ using System.Windows.Navigation; using System.Windows.Shapes; using Tango.Editors; using Tango.Integration.Observables; -using Tango.MachineStudio.Technician.Items; +using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Editors { - /// - /// - /// Represents a editor with position, size and angle control. - /// - /// - /// - /// - /// - /// The following example demonstrates a basic scenario of using and by creating a simple video projection application with the following features: - /// - /// - /// Use the mouse to draw any type of tile of the editor surface. - /// Apply any input shape on any tile. - /// Load any video and display it on any of the selected tile. - /// Built in support for undo, redo, cut, copy and paste, delete and select operations. - /// Built in support for saving/loading the editor state to memory or file. - /// Built in support for tile and editor properties adjustment using the . - /// - /// - /// - /// - /// Code-Behind. - /// - /// - /// [ContentProperty("InnerContent")] public partial class MonitorElementEditor : ElementEditor { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml new file mode 100644 index 000000000..eafc7b5d3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml.cs new file mode 100644 index 000000000..8e8ac556e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.Integration.Observables; +using Tango.MachineStudio.Technician.TechItems; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class SingleGraphElementEditor : ElementEditor + { + /// + /// Initializes a new instance of the class. + /// + public SingleGraphElementEditor() + : base() + { + InitializeComponent(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + public SingleGraphElementEditor(SingleGraphItem graphItem) + : this() + { + GraphItem = graphItem; + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + /// The bounds. + public SingleGraphElementEditor(SingleGraphItem graphItem, Rect bounds) + : this(graphItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private SingleGraphItem _monitorItem; + + public SingleGraphItem GraphItem + { + get { return _monitorItem; } + set { _monitorItem = value; RaisePropertyChanged(nameof(GraphItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + SingleGraphElementEditor cloned = new SingleGraphElementEditor(); + + cloned.GraphItem = GraphItem.Clone() as SingleGraphItem; + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// + /// Gets the hosted element. + /// + [ParameterIgnore] + public override Object HostedElement + { + get { return GraphItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/analog.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/analog.png new file mode 100644 index 000000000..2651a64b0 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/analog.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/graph.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/graph.png new file mode 100644 index 000000000..0aca05e00 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/graph.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/single-graph.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/single-graph.png new file mode 100644 index 000000000..f72f56a87 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/single-graph.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/MonitorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/MonitorItem.cs deleted file mode 100644 index 4150e3784..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/MonitorItem.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Observables; - -namespace Tango.MachineStudio.Technician.Items -{ - public class MonitorItem : TechItem - { - private TechMonitor _techMonitor; - public TechMonitor TechMonitor - { - get { return _techMonitor; } - set { _techMonitor = value; RaisePropertyChangedAuto(); } - } - - private double _value; - public double Value - { - get { return _value; } - set { _value = value; RaisePropertyChanged(nameof(Value)); } - } - - public MonitorItem() : base() - { - - } - - public MonitorItem(TechMonitor techMonitor) : this() - { - TechMonitor = techMonitor; - } - - public override TechItem Clone() - { - MonitorItem cloned = base.Clone() as MonitorItem; - cloned.TechMonitor = TechMonitor; - return cloned; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/TechItem.cs deleted file mode 100644 index bfeeef011..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/TechItem.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Core; - -namespace Tango.MachineStudio.Technician.Items -{ - public abstract class TechItem : ExtendedObject - { - public TechItem() - { - ID = Guid.NewGuid().ToString(); - Name = "Untitled"; - } - - private String _id; - /// - /// Unique Item ID. - /// - public String ID - { - get { return _id; } - set { _id = value; RaisePropertyChanged(nameof(ID)); } - } - - private String _name; - /// - /// item Name. - /// - public String Name - { - get { return _name; } - set { _name = value; RaisePropertyChanged(nameof(Name)); } - } - - private double _left; - /// - /// Item Left. - /// - public double Left - { - get { return _left; } - set { _left = value; RaisePropertyChanged(nameof(Left)); } - } - - private double _top; - /// - /// Item Top. - /// - public double Top - { - get { return _top; } - set { _top = value; RaisePropertyChanged(nameof(Top)); } - } - - private double _width; - /// - /// Item Width. - /// - public double Width - { - get { return _width; } - set { _width = value; RaisePropertyChanged(nameof(Width)); } - } - - private double _height; - /// - /// Item Height. - /// - public double Height - { - get { return _height; } - set { _height = value; RaisePropertyChanged(nameof(Height)); } - } - - private double _angle; - /// - /// Item Angle. - /// - public double Angle - { - get { return _angle; } - set { _angle = value; RaisePropertyChanged(nameof(Angle)); } - } - - public virtual TechItem Clone() - { - TechItem cloned = Activator.CreateInstance(this.GetType()) as TechItem; - cloned.Left = Left; - cloned.Top = Top; - cloned.Width = Width; - cloned.Height = Height; - cloned.Angle = Angle; - return cloned; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml new file mode 100644 index 000000000..66e0e5cba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml @@ -0,0 +1,22 @@ + + + + + + + + + Selected Input + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml.cs new file mode 100644 index 000000000..8b5396ffc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.PropertiesTemplates +{ + /// + /// Interaction logic for MonitorTemplate.xaml + /// + public partial class MonitorTemplate : UserControl + { + public MonitorTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml new file mode 100644 index 000000000..098e7a3dd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml @@ -0,0 +1,22 @@ + + + + + + + + + Selected Input + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml.cs new file mode 100644 index 000000000..4ccb703b4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.MachineStudio.Technician.TechItems; + +namespace Tango.MachineStudio.Technician.PropertiesTemplates +{ + /// + /// Interaction logic for SingleGraphTemplate.xaml + /// + public partial class SingleGraphTemplate : UserControl + { + public SingleGraphTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 6d3ae9c1a..05ab7cc38 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -77,14 +77,25 @@ + + + SingleGraphElementEditor.xaml + MonitorElementEditor.xaml - - + + MonitorTemplate.xaml + + + SingleGraphTemplate.xaml + + + + @@ -110,10 +121,22 @@ GlobalVersionInfo.cs + + MSBuild:Compile + Designer + MSBuild:Compile Designer + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -213,5 +236,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs new file mode 100644 index 000000000..cc1ca4083 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; +using Tango.Integration.Observables; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public class MonitorItem : TechItem + { + private TechMonitor _techMonitor; + [XmlIgnore] + public TechMonitor TechMonitor + { + get { return _techMonitor; } + set { _techMonitor = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Data)); } + } + + private double _value; + [XmlIgnore] + public double Value + { + get { return _value; } + set { _value = value; RaisePropertyChanged(nameof(Value)); } + } + + public override object Data => TechMonitor; + + public MonitorItem() : base() + { + Name = "Monitor"; + Description = "Simple analogue like monitor"; + Image = ResourceHelper.GetImageFromResources("Images/analog.png"); + } + + public MonitorItem(TechMonitor techMonitor) : this() + { + TechMonitor = techMonitor; + } + + public override TechItem Clone() + { + MonitorItem cloned = base.Clone() as MonitorItem; + cloned.TechMonitor = TechMonitor; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs new file mode 100644 index 000000000..9ce559047 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; +using Tango.Integration.Observables; +using Tango.MachineStudio.Technician.Editors; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public class SingleGraphItem : TechItem + { + private TechMonitor _techMonitor; + [XmlIgnore] + public TechMonitor TechMonitor + { + get { return _techMonitor; } + set + { + TechMonitor old = _techMonitor; + + _techMonitor = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(Data)); + + if (_techMonitor != old && Editor != null) + { + Editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(TechMonitor.PointsPerFrame); + Editor.InnerGraph.InvalidateGraph(); + } + } + } + + [XmlIgnore] + public SingleGraphElementEditor Editor { get; set; } + + public override object Data => TechMonitor; + + public SingleGraphItem() : base() + { + Name = "Single Channel Graph"; + Description = "Single channel real-time graph"; + Image = ResourceHelper.GetImageFromResources("Images/single-graph.png"); + } + + public SingleGraphItem(TechMonitor techMonitor) : this() + { + TechMonitor = techMonitor; + } + + public override TechItem Clone() + { + MonitorItem cloned = base.Clone() as MonitorItem; + cloned.TechMonitor = TechMonitor; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs new file mode 100644 index 000000000..820c765cc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using System.Xml.Serialization; +using Tango.Core; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public abstract class TechItem : ExtendedObject + { + public TechItem() + { + ID = Guid.NewGuid().ToString(); + Name = "Untitled"; + Adapter = ObservablesEntitiesAdapter.Instance; + } + + private String _description; + [XmlIgnore] + public String Description + { + get { return _description; } + set { _description = value; RaisePropertyChangedAuto(); } + } + + private BitmapSource _image; + [XmlIgnore] + public BitmapSource Image + { + get { return _image; } + set { _image = value; RaisePropertyChangedAuto(); } + } + + [XmlIgnore] + public ObservablesEntitiesAdapter Adapter { get; set; } + + private String _id; + /// + /// Unique Item ID. + /// + public String ID + { + get { return _id; } + set { _id = value; RaisePropertyChanged(nameof(ID)); } + } + + private String _name; + /// + /// item Name. + /// + [XmlIgnore] + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChanged(nameof(Name)); } + } + + private double _left; + /// + /// Item Left. + /// + public double Left + { + get { return _left; } + set { _left = value; RaisePropertyChanged(nameof(Left)); } + } + + private double _top; + /// + /// Item Top. + /// + public double Top + { + get { return _top; } + set { _top = value; RaisePropertyChanged(nameof(Top)); } + } + + private double _width; + /// + /// Item Width. + /// + public double Width + { + get { return _width; } + set { _width = value; RaisePropertyChanged(nameof(Width)); } + } + + private double _height; + /// + /// Item Height. + /// + public double Height + { + get { return _height; } + set { _height = value; RaisePropertyChanged(nameof(Height)); } + } + + private double _angle; + /// + /// Item Angle. + /// + public double Angle + { + get { return _angle; } + set { _angle = value; RaisePropertyChanged(nameof(Angle)); } + } + + [XmlIgnore] + public abstract object Data { get; } + + public virtual TechItem Clone() + { + TechItem cloned = Activator.CreateInstance(this.GetType()) as TechItem; + cloned.Left = Left; + cloned.Top = Top; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + + public static List GetAvailableTechItems() + { + List items = new List(); + + foreach (var type in typeof(TechItem).Assembly.GetTypes().Where(x => typeof(TechItem).IsAssignableFrom(x) && !x.IsAbstract)) + { + items.Add(Activator.CreateInstance(type) as TechItem); + } + + return items; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs index 6bdc4c7df..c75bcdf29 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs @@ -43,7 +43,7 @@ namespace Tango.MachineStudio.Technician /// /// Gets the module entry point view. /// - public FrameworkElement MainView => new MainView(); + public FrameworkElement MainView => new MachineTechView(); /// /// Gets the permission required to see and load this module. diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 51c2b840d..4420aa4c9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -1,42 +1,179 @@ -using System; +using Google.Protobuf.Collections; +using RealTimeGraphEx.Controllers; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows; using Tango.Editors; using Tango.Integration.Observables; +using Tango.Integration.Operators; +using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Technician.Editors; -using Tango.MachineStudio.Technician.Items; +using Tango.MachineStudio.Technician.TechItems; +using Tango.PMR.Diagnostics; using Tango.SharedUI; namespace Tango.MachineStudio.Technician.ViewModels { public class MachineTechViewVM : ViewModel { - private ObservableCollection _elements; + private List _diagnoticsDataProperties; + private Dictionary _singleControllers; + private static object _elementsLock = new object(); + private ObservableCollection _elements; public ObservableCollection Elements { get { return _elements; } set { _elements = value; RaisePropertyChangedAuto(); } } + private ObservableCollection _availableTechItems; + public ObservableCollection AvailableTechItems + { + get { return _availableTechItems; } + set { _availableTechItems = value; RaisePropertyChangedAuto(); } + } + + private TechItem _selectedTechItem; + + public TechItem SelectedTechItem + { + get { return _selectedTechItem; } + set { _selectedTechItem = value; RaisePropertyChangedAuto(); } + } + public ObservablesEntitiesAdapter Adapter { get; set; } - public MachineTechViewVM() + public IStudioApplicationManager ApplicationManager { get; set; } + + private IMachineOperator _machineOperator; + + public IMachineOperator MachineOperator { + get { return _machineOperator; } + set { _machineOperator = value; RaisePropertyChangedAuto(); } + } + + public MachineTechViewVM(IStudioApplicationManager applicationManager) + { + _singleControllers = new Dictionary(); + AvailableTechItems = TechItem.GetAvailableTechItems().ToObservableCollection(); + SelectedTechItem = AvailableTechItems.FirstOrDefault(); + _diagnoticsDataProperties = typeof(PushDiagnosticsResponse).GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList(); + ApplicationManager = applicationManager; + ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + Adapter = ObservablesEntitiesAdapter.Instance; - Adapter.Initialize(); //TODO: Remove on Machine Studio. + //Adapter.Initialize(); //TODO: Remove on Machine Studio. Elements = new ObservableCollection(); } + private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine) + { + MachineOperator = machine; + + if (MachineOperator != null) + { + MachineOperator.DiagnosticsDataAvailable -= MachineOperator_DiagnosticsDataAvailable; + MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; + } + } + + private void MachineOperator_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse response) + { + PopulateDiagnosticsData(response); + } + + private void PopulateDiagnosticsData(PushDiagnosticsResponse data) + { + lock (_elementsLock) + { + var elements = Elements.ToList(); + + foreach (var item in elements.Select(x => x.HostedElement as TechItem)) + { + if (item.GetType() == typeof(MonitorItem)) + { + MonitorItem monitorItem = item as MonitorItem; + + var prop = _diagnoticsDataProperties.SingleOrDefault(x => x.Name == monitorItem.TechMonitor.Name); + + if (prop != null) + { + monitorItem.Value = GetLastMonitorValue(monitorItem.TechMonitor, prop.GetValue(data)); + } + } + else if (item.GetType() == typeof(SingleGraphItem)) + { + SingleGraphItem graphItem = item as SingleGraphItem; + + var prop = _diagnoticsDataProperties.SingleOrDefault(x => x.Name == graphItem.TechMonitor.Name); + + if (prop != null) + { + GraphController controller = null; + + if (_singleControllers.TryGetValue(graphItem, out controller)) + { + controller.PushData(GetSingleGraphValues(graphItem.TechMonitor, prop.GetValue(data))); + } + } + } + } + } + } + + private double GetLastMonitorValue(TechMonitor monitor, object value) + { + if (!monitor.MultiChannel) + { + RepeatedField arr = value as RepeatedField; + return arr.LastOrDefault(); + } + else + { + RepeatedField arr = value as RepeatedField; + return arr.Last().Data.Last(); + } + } + + private List GetSingleGraphValues(TechMonitor monitor, object value) + { + return (value as RepeatedField).ToList(); + } + public void AddElement(Rect bounds) { - MonitorItem item = new MonitorItem(Adapter.TechMonitors.FirstOrDefault()); - MonitorElementEditor editor = new MonitorElementEditor(item, bounds); - Elements.Add(editor); + lock (_elementsLock) + { + if (SelectedTechItem is MonitorItem) + { + var monitorItem = new MonitorItem(Adapter.TechMonitors.FirstOrDefault()); + MonitorElementEditor editor = new MonitorElementEditor(monitorItem, bounds); + Elements.Add(editor); + } + else if (SelectedTechItem is SingleGraphItem) + { + var graphItem = new SingleGraphItem(Adapter.TechMonitors.FirstOrDefault()); + SingleGraphElementEditor editor = new SingleGraphElementEditor(graphItem, bounds); + editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(graphItem.TechMonitor.PointsPerFrame); + editor.DataContext = graphItem; + graphItem.Editor = editor; + + + GraphController controller = new GraphController(); + editor.InnerGraph.Controller = controller; + + _singleControllers.Add(graphItem, controller); + + Elements.Add(editor); + } + } } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 256a4a385..371caf5d7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -5,8 +5,11 @@ xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" xmlns:global="clr-namespace:Tango.MachineStudio.Technician" xmlns:editors="clr-namespace:Tango.Editors;assembly=Tango.Editors" + xmlns:techItems="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:templates="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" + xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" @@ -37,7 +40,34 @@ - + + + + + + + + + + + + + + + + + + + @@ -49,12 +79,15 @@ - - - + + + + + + + + Left + + + + Top + + + + + + + + Width + + + + Height + + + + + + + + + + + Angle + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml index 449cea493..0f9edee55 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml @@ -62,12 +62,12 @@ - - + + - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs index c1728a975..57d5ab88a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs @@ -50,6 +50,35 @@ namespace Tango.MachineStudio.Common.Controls public static readonly DependencyProperty SensorUnitsProperty = DependencyProperty.Register("SensorUnits", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null)); + + + public double Minimum + { + get { return (double)GetValue(MinimumProperty); } + set { SetValue(MinimumProperty, value); } + } + public static readonly DependencyProperty MinimumProperty = + DependencyProperty.Register("Minimum", typeof(double), typeof(RealTimeGraphControl), new PropertyMetadata(0.0)); + + + + public double Maximum + { + get { return (double)GetValue(MaximumProperty); } + set { SetValue(MaximumProperty, value); } + } + public static readonly DependencyProperty MaximumProperty = + DependencyProperty.Register("Maximum", typeof(double), typeof(RealTimeGraphControl), new PropertyMetadata(100.0)); + + + + public void InvalidateGraph() + { + InnerGraph.Clear(); + yAxis.Render(InnerGraph); + yAxisTicks.Render(InnerGraph); + } + /// /// Gets or sets the inner real-time graph control. /// diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs index 16264aa4b..f0c612608 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs @@ -901,7 +901,6 @@ namespace RealTimeGraphEx { } - #endregion #region Protected Methods @@ -1051,6 +1050,16 @@ namespace RealTimeGraphEx return b; } + public void Clear() + { + ClearGraph(); + } + + public void RenderComponents() + { + OnRenderComponents(); + } + #endregion #region Static Methods diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 197e4f369..87fddc183 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -143,6 +143,15 @@ namespace Tango.Emulations.Emulators } res.DispensersMotorsFrequency.AddRange(dispenserFrequencies); + + res.Dispenser1MotorFrequency.AddRange(dispenserFrequencies[0].Data); + res.Dispenser2MotorFrequency.AddRange(dispenserFrequencies[1].Data); + res.Dispenser3MotorFrequency.AddRange(dispenserFrequencies[2].Data); + res.Dispenser4MotorFrequency.AddRange(dispenserFrequencies[3].Data); + res.Dispenser5MotorFrequency.AddRange(dispenserFrequencies[4].Data); + res.Dispenser6MotorFrequency.AddRange(dispenserFrequencies[5].Data); + res.Dispenser7MotorFrequency.AddRange(dispenserFrequencies[6].Data); + res.Dispenser8MotorFrequency.AddRange(dispenserFrequencies[7].Data); } Transporter.SendResponse(res, container.Token); diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs index 85fba5d22..d654f77a1 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs @@ -23,16 +23,22 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch1QdXNoRGlhZ25vc3RpY3NSZXNwb25zZS5wcm90bxIVVGFuZ28uUE1SLkRp", - "YWdub3N0aWNzGhFEb3VibGVBcnJheS5wcm90byKiAQoXUHVzaERpYWdub3N0", + "YWdub3N0aWNzGhFEb3VibGVBcnJheS5wcm90byKyAwoXUHVzaERpYWdub3N0", "aWNzUmVzcG9uc2USFAoMRGFuY2VyMUFuZ2xlGAEgAygBEhQKDERhbmNlcjJB", "bmdsZRgCIAMoARIUCgxEYW5jZXIzQW5nbGUYAyADKAESRQoZRGlzcGVuc2Vy", "c01vdG9yc0ZyZXF1ZW5jeRgEIAMoCzIiLlRhbmdvLlBNUi5EaWFnbm9zdGlj", - "cy5Eb3VibGVBcnJheUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0", - "aWNzYgZwcm90bzM=")); + "cy5Eb3VibGVBcnJheRIgChhEaXNwZW5zZXIxTW90b3JGcmVxdWVuY3kYBSAD", + "KAESIAoYRGlzcGVuc2VyMk1vdG9yRnJlcXVlbmN5GAYgAygBEiAKGERpc3Bl", + "bnNlcjNNb3RvckZyZXF1ZW5jeRgHIAMoARIgChhEaXNwZW5zZXI0TW90b3JG", + "cmVxdWVuY3kYCCADKAESIAoYRGlzcGVuc2VyNU1vdG9yRnJlcXVlbmN5GAkg", + "AygBEiAKGERpc3BlbnNlcjZNb3RvckZyZXF1ZW5jeRgKIAMoARIgChhEaXNw", + "ZW5zZXI3TW90b3JGcmVxdWVuY3kYCyADKAESIAoYRGlzcGVuc2VyOE1vdG9y", + "RnJlcXVlbmN5GAwgAygBQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlhZ25v", + "c3RpY3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.DoubleArrayReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.PushDiagnosticsResponse), global::Tango.PMR.Diagnostics.PushDiagnosticsResponse.Parser, new[]{ "Dancer1Angle", "Dancer2Angle", "Dancer3Angle", "DispensersMotorsFrequency" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.PushDiagnosticsResponse), global::Tango.PMR.Diagnostics.PushDiagnosticsResponse.Parser, new[]{ "Dancer1Angle", "Dancer2Angle", "Dancer3Angle", "DispensersMotorsFrequency", "Dispenser1MotorFrequency", "Dispenser2MotorFrequency", "Dispenser3MotorFrequency", "Dispenser4MotorFrequency", "Dispenser5MotorFrequency", "Dispenser6MotorFrequency", "Dispenser7MotorFrequency", "Dispenser8MotorFrequency" }, null, null, null) })); } #endregion @@ -67,6 +73,14 @@ namespace Tango.PMR.Diagnostics { dancer2Angle_ = other.dancer2Angle_.Clone(); dancer3Angle_ = other.dancer3Angle_.Clone(); dispensersMotorsFrequency_ = other.dispensersMotorsFrequency_.Clone(); + dispenser1MotorFrequency_ = other.dispenser1MotorFrequency_.Clone(); + dispenser2MotorFrequency_ = other.dispenser2MotorFrequency_.Clone(); + dispenser3MotorFrequency_ = other.dispenser3MotorFrequency_.Clone(); + dispenser4MotorFrequency_ = other.dispenser4MotorFrequency_.Clone(); + dispenser5MotorFrequency_ = other.dispenser5MotorFrequency_.Clone(); + dispenser6MotorFrequency_ = other.dispenser6MotorFrequency_.Clone(); + dispenser7MotorFrequency_ = other.dispenser7MotorFrequency_.Clone(); + dispenser8MotorFrequency_ = other.dispenser8MotorFrequency_.Clone(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -109,11 +123,97 @@ namespace Tango.PMR.Diagnostics { private static readonly pb::FieldCodec _repeated_dispensersMotorsFrequency_codec = pb::FieldCodec.ForMessage(34, global::Tango.PMR.Diagnostics.DoubleArray.Parser); private readonly pbc::RepeatedField dispensersMotorsFrequency_ = new pbc::RepeatedField(); + /// + ///Dispensers Motors Frequency Multi + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField DispensersMotorsFrequency { get { return dispensersMotorsFrequency_; } } + /// Field number for the "Dispenser1MotorFrequency" field. + public const int Dispenser1MotorFrequencyFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_dispenser1MotorFrequency_codec + = pb::FieldCodec.ForDouble(42); + private readonly pbc::RepeatedField dispenser1MotorFrequency_ = new pbc::RepeatedField(); + /// + ///Dispensers Motors Frequency Singles + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Dispenser1MotorFrequency { + get { return dispenser1MotorFrequency_; } + } + + /// Field number for the "Dispenser2MotorFrequency" field. + public const int Dispenser2MotorFrequencyFieldNumber = 6; + private static readonly pb::FieldCodec _repeated_dispenser2MotorFrequency_codec + = pb::FieldCodec.ForDouble(50); + private readonly pbc::RepeatedField dispenser2MotorFrequency_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Dispenser2MotorFrequency { + get { return dispenser2MotorFrequency_; } + } + + /// Field number for the "Dispenser3MotorFrequency" field. + public const int Dispenser3MotorFrequencyFieldNumber = 7; + private static readonly pb::FieldCodec _repeated_dispenser3MotorFrequency_codec + = pb::FieldCodec.ForDouble(58); + private readonly pbc::RepeatedField dispenser3MotorFrequency_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Dispenser3MotorFrequency { + get { return dispenser3MotorFrequency_; } + } + + /// Field number for the "Dispenser4MotorFrequency" field. + public const int Dispenser4MotorFrequencyFieldNumber = 8; + private static readonly pb::FieldCodec _repeated_dispenser4MotorFrequency_codec + = pb::FieldCodec.ForDouble(66); + private readonly pbc::RepeatedField dispenser4MotorFrequency_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Dispenser4MotorFrequency { + get { return dispenser4MotorFrequency_; } + } + + /// Field number for the "Dispenser5MotorFrequency" field. + public const int Dispenser5MotorFrequencyFieldNumber = 9; + private static readonly pb::FieldCodec _repeated_dispenser5MotorFrequency_codec + = pb::FieldCodec.ForDouble(74); + private readonly pbc::RepeatedField dispenser5MotorFrequency_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Dispenser5MotorFrequency { + get { return dispenser5MotorFrequency_; } + } + + /// Field number for the "Dispenser6MotorFrequency" field. + public const int Dispenser6MotorFrequencyFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_dispenser6MotorFrequency_codec + = pb::FieldCodec.ForDouble(82); + private readonly pbc::RepeatedField dispenser6MotorFrequency_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Dispenser6MotorFrequency { + get { return dispenser6MotorFrequency_; } + } + + /// Field number for the "Dispenser7MotorFrequency" field. + public const int Dispenser7MotorFrequencyFieldNumber = 11; + private static readonly pb::FieldCodec _repeated_dispenser7MotorFrequency_codec + = pb::FieldCodec.ForDouble(90); + private readonly pbc::RepeatedField dispenser7MotorFrequency_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Dispenser7MotorFrequency { + get { return dispenser7MotorFrequency_; } + } + + /// Field number for the "Dispenser8MotorFrequency" field. + public const int Dispenser8MotorFrequencyFieldNumber = 12; + private static readonly pb::FieldCodec _repeated_dispenser8MotorFrequency_codec + = pb::FieldCodec.ForDouble(98); + private readonly pbc::RepeatedField dispenser8MotorFrequency_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Dispenser8MotorFrequency { + get { return dispenser8MotorFrequency_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as PushDiagnosticsResponse); @@ -131,6 +231,14 @@ namespace Tango.PMR.Diagnostics { if(!dancer2Angle_.Equals(other.dancer2Angle_)) return false; if(!dancer3Angle_.Equals(other.dancer3Angle_)) return false; if(!dispensersMotorsFrequency_.Equals(other.dispensersMotorsFrequency_)) return false; + if(!dispenser1MotorFrequency_.Equals(other.dispenser1MotorFrequency_)) return false; + if(!dispenser2MotorFrequency_.Equals(other.dispenser2MotorFrequency_)) return false; + if(!dispenser3MotorFrequency_.Equals(other.dispenser3MotorFrequency_)) return false; + if(!dispenser4MotorFrequency_.Equals(other.dispenser4MotorFrequency_)) return false; + if(!dispenser5MotorFrequency_.Equals(other.dispenser5MotorFrequency_)) return false; + if(!dispenser6MotorFrequency_.Equals(other.dispenser6MotorFrequency_)) return false; + if(!dispenser7MotorFrequency_.Equals(other.dispenser7MotorFrequency_)) return false; + if(!dispenser8MotorFrequency_.Equals(other.dispenser8MotorFrequency_)) return false; return true; } @@ -141,6 +249,14 @@ namespace Tango.PMR.Diagnostics { hash ^= dancer2Angle_.GetHashCode(); hash ^= dancer3Angle_.GetHashCode(); hash ^= dispensersMotorsFrequency_.GetHashCode(); + hash ^= dispenser1MotorFrequency_.GetHashCode(); + hash ^= dispenser2MotorFrequency_.GetHashCode(); + hash ^= dispenser3MotorFrequency_.GetHashCode(); + hash ^= dispenser4MotorFrequency_.GetHashCode(); + hash ^= dispenser5MotorFrequency_.GetHashCode(); + hash ^= dispenser6MotorFrequency_.GetHashCode(); + hash ^= dispenser7MotorFrequency_.GetHashCode(); + hash ^= dispenser8MotorFrequency_.GetHashCode(); return hash; } @@ -155,6 +271,14 @@ namespace Tango.PMR.Diagnostics { dancer2Angle_.WriteTo(output, _repeated_dancer2Angle_codec); dancer3Angle_.WriteTo(output, _repeated_dancer3Angle_codec); dispensersMotorsFrequency_.WriteTo(output, _repeated_dispensersMotorsFrequency_codec); + dispenser1MotorFrequency_.WriteTo(output, _repeated_dispenser1MotorFrequency_codec); + dispenser2MotorFrequency_.WriteTo(output, _repeated_dispenser2MotorFrequency_codec); + dispenser3MotorFrequency_.WriteTo(output, _repeated_dispenser3MotorFrequency_codec); + dispenser4MotorFrequency_.WriteTo(output, _repeated_dispenser4MotorFrequency_codec); + dispenser5MotorFrequency_.WriteTo(output, _repeated_dispenser5MotorFrequency_codec); + dispenser6MotorFrequency_.WriteTo(output, _repeated_dispenser6MotorFrequency_codec); + dispenser7MotorFrequency_.WriteTo(output, _repeated_dispenser7MotorFrequency_codec); + dispenser8MotorFrequency_.WriteTo(output, _repeated_dispenser8MotorFrequency_codec); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -164,6 +288,14 @@ namespace Tango.PMR.Diagnostics { size += dancer2Angle_.CalculateSize(_repeated_dancer2Angle_codec); size += dancer3Angle_.CalculateSize(_repeated_dancer3Angle_codec); size += dispensersMotorsFrequency_.CalculateSize(_repeated_dispensersMotorsFrequency_codec); + size += dispenser1MotorFrequency_.CalculateSize(_repeated_dispenser1MotorFrequency_codec); + size += dispenser2MotorFrequency_.CalculateSize(_repeated_dispenser2MotorFrequency_codec); + size += dispenser3MotorFrequency_.CalculateSize(_repeated_dispenser3MotorFrequency_codec); + size += dispenser4MotorFrequency_.CalculateSize(_repeated_dispenser4MotorFrequency_codec); + size += dispenser5MotorFrequency_.CalculateSize(_repeated_dispenser5MotorFrequency_codec); + size += dispenser6MotorFrequency_.CalculateSize(_repeated_dispenser6MotorFrequency_codec); + size += dispenser7MotorFrequency_.CalculateSize(_repeated_dispenser7MotorFrequency_codec); + size += dispenser8MotorFrequency_.CalculateSize(_repeated_dispenser8MotorFrequency_codec); return size; } @@ -176,6 +308,14 @@ namespace Tango.PMR.Diagnostics { dancer2Angle_.Add(other.dancer2Angle_); dancer3Angle_.Add(other.dancer3Angle_); dispensersMotorsFrequency_.Add(other.dispensersMotorsFrequency_); + dispenser1MotorFrequency_.Add(other.dispenser1MotorFrequency_); + dispenser2MotorFrequency_.Add(other.dispenser2MotorFrequency_); + dispenser3MotorFrequency_.Add(other.dispenser3MotorFrequency_); + dispenser4MotorFrequency_.Add(other.dispenser4MotorFrequency_); + dispenser5MotorFrequency_.Add(other.dispenser5MotorFrequency_); + dispenser6MotorFrequency_.Add(other.dispenser6MotorFrequency_); + dispenser7MotorFrequency_.Add(other.dispenser7MotorFrequency_); + dispenser8MotorFrequency_.Add(other.dispenser8MotorFrequency_); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -205,6 +345,46 @@ namespace Tango.PMR.Diagnostics { dispensersMotorsFrequency_.AddEntriesFrom(input, _repeated_dispensersMotorsFrequency_codec); break; } + case 42: + case 41: { + dispenser1MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser1MotorFrequency_codec); + break; + } + case 50: + case 49: { + dispenser2MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser2MotorFrequency_codec); + break; + } + case 58: + case 57: { + dispenser3MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser3MotorFrequency_codec); + break; + } + case 66: + case 65: { + dispenser4MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser4MotorFrequency_codec); + break; + } + case 74: + case 73: { + dispenser5MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser5MotorFrequency_codec); + break; + } + case 82: + case 81: { + dispenser6MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser6MotorFrequency_codec); + break; + } + case 90: + case 89: { + dispenser7MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser7MotorFrequency_codec); + break; + } + case 98: + case 97: { + dispenser8MotorFrequency_.AddEntriesFrom(input, _repeated_dispenser8MotorFrequency_codec); + break; + } } } } -- cgit v1.3.1 From 1b74cee6e9073f3542b4733574ab304f40fc033b Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 8 Feb 2018 23:53:00 +0200 Subject: Working on MachineTechView.. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes Software/Graphics/box.png | Bin 0 -> 64765 bytes Software/Graphics/glass.png | Bin 0 -> 17468 bytes Software/Graphics/white-box.png | Bin 0 -> 56987 bytes .../Editors/MonitorElementEditor.xaml | 24 +++++++++++++--- .../Editors/SingleGraphElementEditor.xaml | 4 +-- .../Tango.MachineStudio.Technician/Images/box.png | Bin 0 -> 64765 bytes .../Images/seamless-grid.jpg | Bin 0 -> 12022 bytes .../Images/white-box.png | Bin 0 -> 56987 bytes .../PropertiesTemplates/MonitorTemplate.xaml | 18 +++++++++++- .../PropertiesTemplates/SingleGraphTemplate.xaml | 12 ++++++++ .../Tango.MachineStudio.Technician.csproj | 13 +++++++++ .../TechItems/MonitorItem.cs | 18 ++++++++++-- .../TechItems/TechItem.cs | 10 +++++++ .../ViewModels/MachineTechViewVM.cs | 12 +++++--- .../Views/MachineTechView.xaml | 31 +++++++++++++-------- .../Controls/RealTimeGraphControl.xaml | 4 +-- .../Controls/RealTimeGraphControl.xaml.cs | 10 +++++++ .../Tango.MachineStudio.UI/ViewModelLocator.cs | 8 ++++++ 20 files changed, 138 insertions(+), 26 deletions(-) create mode 100644 Software/Graphics/box.png create mode 100644 Software/Graphics/glass.png create mode 100644 Software/Graphics/white-box.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/box.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/seamless-grid.jpg create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/white-box.png (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 8f36c9d40..5be040772 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 29ebe00a1..85a0b368d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/box.png b/Software/Graphics/box.png new file mode 100644 index 000000000..105de7979 Binary files /dev/null and b/Software/Graphics/box.png differ diff --git a/Software/Graphics/glass.png b/Software/Graphics/glass.png new file mode 100644 index 000000000..eeb67d27c Binary files /dev/null and b/Software/Graphics/glass.png differ diff --git a/Software/Graphics/white-box.png b/Software/Graphics/white-box.png new file mode 100644 index 000000000..aee42d95a Binary files /dev/null and b/Software/Graphics/white-box.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml index 84eae5f75..8e4520cc5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml @@ -3,10 +3,11 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5"> + d:DesignHeight="250" d:DesignWidth="300" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:MonitorItem, IsDesignTimeCreatable=False}"> @@ -28,12 +29,27 @@ - + - + - + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml index eafc7b5d3..02acf5883 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml @@ -8,7 +8,7 @@ xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" mc:Ignorable="d" - d:DesignHeight="150" d:DesignWidth="400" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:MonitorItem, IsDesignTimeCreatable=False}"> + d:DesignHeight="150" d:DesignWidth="400" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:SingleGraphItem, IsDesignTimeCreatable=False}"> @@ -28,7 +28,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/box.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/box.png new file mode 100644 index 000000000..105de7979 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/box.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/seamless-grid.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/seamless-grid.jpg new file mode 100644 index 000000000..59bb9c370 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/seamless-grid.jpg differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/white-box.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/white-box.png new file mode 100644 index 000000000..aee42d95a Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/white-box.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml index 66e0e5cba..f87926d28 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml @@ -5,18 +5,34 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="200" d:DataContext="{d:DesignInstance Type=items:MonitorItem, IsDesignTimeCreatable=False}"> + + - + Selected Input + + Update Interval + + + Color + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml index 098e7a3dd..bc31f8b31 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml @@ -3,6 +3,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" @@ -11,12 +13,22 @@ + + Selected Input + + Color + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 05ab7cc38..502ec398d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -193,6 +193,10 @@ {b9ae25d6-be35-492f-9079-21a7f3e6f7cc} RealTimeGraphEx + + {a2f5af44-29ff-45d6-9d25-ecda5cce88b5} + Tango.ColorPicker + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core @@ -245,5 +249,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs index cc1ca4083..e04cdf675 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Media; using System.Xml.Serialization; using Tango.Integration.Observables; using Tango.SharedUI.Helpers; @@ -24,16 +25,29 @@ namespace Tango.MachineStudio.Technician.TechItems public double Value { get { return _value; } - set { _value = value; RaisePropertyChanged(nameof(Value)); } + set { _value = value; RaisePropertyChanged(nameof(Value)); LastUpdateTime = DateTime.Now; } } + private int _updateInterval; + public int UpdateInterval + { + get { return _updateInterval; } + set { _updateInterval = value; RaisePropertyChangedAuto(); } + } + + [XmlIgnore] + public DateTime LastUpdateTime { get; set; } + public override object Data => TechMonitor; public MonitorItem() : base() { Name = "Monitor"; + Color = Color.FromRgb(20, 20, 20); Description = "Simple analogue like monitor"; Image = ResourceHelper.GetImageFromResources("Images/analog.png"); + LastUpdateTime = DateTime.Now; + UpdateInterval = 10; } public MonitorItem(TechMonitor techMonitor) : this() @@ -43,7 +57,7 @@ namespace Tango.MachineStudio.Technician.TechItems public override TechItem Clone() { - MonitorItem cloned = base.Clone() as MonitorItem; + MonitorItem cloned = base.Clone() as MonitorItem; cloned.TechMonitor = TechMonitor; return cloned; } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs index 820c765cc..75296561a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Media; using System.Windows.Media.Imaging; using System.Xml.Serialization; using Tango.Core; @@ -17,6 +18,7 @@ namespace Tango.MachineStudio.Technician.TechItems ID = Guid.NewGuid().ToString(); Name = "Untitled"; Adapter = ObservablesEntitiesAdapter.Instance; + _color = Colors.DodgerBlue; } private String _description; @@ -112,6 +114,14 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlIgnore] public abstract object Data { get; } + private Color _color; + [XmlIgnore] + public Color Color + { + get { return _color; } + set { _color = value; RaisePropertyChangedAuto(); } + } + public virtual TechItem Clone() { TechItem cloned = Activator.CreateInstance(this.GetType()) as TechItem; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 4420aa4c9..2be98e619 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -101,11 +101,14 @@ namespace Tango.MachineStudio.Technician.ViewModels { MonitorItem monitorItem = item as MonitorItem; - var prop = _diagnoticsDataProperties.SingleOrDefault(x => x.Name == monitorItem.TechMonitor.Name); - - if (prop != null) + if (DateTime.Now > monitorItem.LastUpdateTime.AddMilliseconds(monitorItem.UpdateInterval)) { - monitorItem.Value = GetLastMonitorValue(monitorItem.TechMonitor, prop.GetValue(data)); + var prop = _diagnoticsDataProperties.SingleOrDefault(x => x.Name == monitorItem.TechMonitor.Name); + + if (prop != null) + { + monitorItem.Value = GetLastMonitorValue(monitorItem.TechMonitor, prop.GetValue(data)); + } } } else if (item.GetType() == typeof(SingleGraphItem)) @@ -155,6 +158,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { var monitorItem = new MonitorItem(Adapter.TechMonitors.FirstOrDefault()); MonitorElementEditor editor = new MonitorElementEditor(monitorItem, bounds); + editor.DataContext = monitorItem; Elements.Add(editor); } else if (SelectedTechItem is SingleGraphItem) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 371caf5d7..2c895a789 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" xmlns:global="clr-namespace:Tango.MachineStudio.Technician" + xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:editors="clr-namespace:Tango.Editors;assembly=Tango.Editors" xmlns:techItems="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" @@ -14,7 +15,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" Background="White" d:DataContext="{d:DesignInstance Type=vm:MachineTechViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineTechViewVM}"> + d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MachineTechViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineTechViewVM}"> @@ -33,7 +34,7 @@ - + @@ -78,29 +79,34 @@ + + + + + + - - - + + + @@ -142,6 +148,9 @@ + + + @@ -151,7 +160,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml index 0f9edee55..aa8fd74ad 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml @@ -60,14 +60,14 @@ - + - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs index 57d5ab88a..dd9aa1414 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs @@ -72,6 +72,16 @@ namespace Tango.MachineStudio.Common.Controls + public Color Color + { + get { return (Color)GetValue(ColorProperty); } + set { SetValue(ColorProperty, value); } + } + public static readonly DependencyProperty ColorProperty = + DependencyProperty.Register("Color", typeof(Color), typeof(RealTimeGraphControl), new PropertyMetadata(Colors.DodgerBlue)); + + + public void InvalidateGraph() { InnerGraph.Clear(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 597dfd819..daa24f087 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -71,6 +71,14 @@ namespace Tango.MachineStudio.UI LogManager.Categories.Clear(); LogManager.Categories.AddRange(SettingsManager.Default.MachineStudio.LoggingCategories); + if (LogManager.Categories.Count == 0) + { + LogManager.Categories.Add(LogCategory.Critical); + LogManager.Categories.Add(LogCategory.Error); + LogManager.Categories.Add(LogCategory.General); + LogManager.Categories.Add(LogCategory.Warning); + } + LogManager.RegisterLogger(new VSOutputLogger()); LogManager.RegisterLogger(new FileLogger()); } -- cgit v1.3.1