aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-01 18:22:44 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-01 18:22:44 +0200
commit40990f3c352117fc536fdf004956d120bc63ee09 (patch)
treeedb82f81e9f16fac3d7e409ec279eae50fa1642f /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels
parentc43439d0c4b7f4434eaf277c0f60c5e3c0494ac2 (diff)
downloadTango-40990f3c352117fc536fdf004956d120bc63ee09.tar.gz
Tango-40990f3c352117fc536fdf004956d120bc63ee09.zip
Added sensors data support for developer module.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs48
1 files changed, 48 insertions, 0 deletions
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 52d67a141..4f045627d 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
@@ -19,6 +19,9 @@ using System.Windows.Threading;
using Tango.Settings;
using Tango.MachineStudio.Developer.Views;
using Tango.Video.DirectCapture;
+using Tango.Integration.Operators;
+using Tango.PMR.Diagnostics;
+using System.Reflection;
namespace Tango.MachineStudio.Developer.ViewModels
{
@@ -292,6 +295,17 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// Gets or sets the capture devices.
/// </summary>
public ObservableCollection<CaptureDevice> CaptureDevices { get; set; }
+
+ private IMachineOperator _machineOperator;
+ /// <summary>
+ /// Gets or sets the machine operator.
+ /// </summary>
+ public IMachineOperator MachineOperator
+ {
+ get { return _machineOperator; }
+ set { _machineOperator = value; RaisePropertyChangedAuto(); }
+ }
+
#endregion
#region Commands
@@ -441,6 +455,40 @@ namespace Tango.MachineStudio.Developer.ViewModels
}
ToggleCameraCommand = new RelayCommand<CaptureDevice>(ToggleCamera);
+
+ ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged;
+ }
+
+ private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine)
+ {
+ MachineOperator = machine;
+
+ if (MachineOperator != null)
+ {
+ MachineOperator.EnableSensorsUpdate = true;
+ MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable;
+ }
+ }
+
+ private void MachineOperator_DiagnosticsDataAvailable(object sender, StartDiagnosticsResponse response)
+ {
+ foreach (var prop in response.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
+ {
+ GraphControllerBase controller = null;
+
+ if (_controllers.TryGetValue(prop.Name, out controller))
+ {
+ if (controller is GraphController)
+ {
+ double[] arr = Enumerable.ToArray(prop.GetValue(response) as IEnumerable<double>);
+ (controller as GraphController).PushData(arr);
+ }
+ else
+ {
+ //Multi Graph...
+ }
+ }
+ }
}
#endregion