From a84ca3e4bee123600c08f8897eca5be83b3ffcf8 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 11 Feb 2018 21:46:22 +0200 Subject: Added TechView for Developer.. --- .../ViewModels/MainViewVM.cs | 13 +++ .../ViewModels/MonitoringViewVM.cs | 93 ---------------------- 2 files changed, 13 insertions(+), 93 deletions(-) delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels') 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 d6c127b1f..f9ec5b063 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 @@ -28,6 +28,7 @@ using Tango.Transport; using Tango.Integration.Printing; using Tango.Integration.Diagnostics; using Microsoft.Win32; +using Tango.MachineStudio.Technician.ViewModels; namespace Tango.MachineStudio.Developer.ViewModels { @@ -344,6 +345,16 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _fullScreenGraph = value; RaisePropertyChangedAuto(); } } + private MachineTechViewVM _machineTechViewVM; + /// + /// Gets or sets the machine tech view models. + /// + public MachineTechViewVM MachineTechViewVM + { + get { return _machineTechViewVM; } + set { _machineTechViewVM = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -535,6 +546,8 @@ namespace Tango.MachineStudio.Developer.ViewModels ToggleCameraCommand = new RelayCommand(ToggleCamera); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + + MachineTechViewVM = new MachineTechViewVM(applicationManager, notificationProvider, false); } #endregion diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs deleted file mode 100644 index 99fbc5114..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Google.Protobuf.Collections; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Observables; -using Tango.Integration.Services; -using Tango.MachineStudio.Common.StudioApplication; -using Tango.PMR.Diagnostics; -using Tango.SharedUI; - -namespace Tango.MachineStudio.Developer.ViewModels -{ - public class MonitoringViewVM : ViewModel - { - private ObservableCollection _availableControllers; - public ObservableCollection AvailableControllers - { - get { return _availableControllers; } - set { _availableControllers = value; } - } - - private ObservableCollection _controllers; - public ObservableCollection Controllers - { - get { return _controllers; } - set { _controllers = value; } - } - - private ObservablesEntitiesAdapter _adapter; - public ObservablesEntitiesAdapter Adapter - { - get { return _adapter; } - set { _adapter = value; } - } - - public IStudioApplicationManager ApplicationManager { get; set; } - - public MonitoringViewVM(IStudioApplicationManager applicationManager) - { - ApplicationManager = applicationManager; - ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; - - if (!this.DesignMode) - { - Adapter = ObservablesEntitiesAdapter.Instance; - AvailableControllers = Adapter.TechMonitors.Select(x => new IOVM(x, x.Name)).ToObservableCollection(); - } - - Controllers = new ObservableCollection(); - } - - private void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machine) - { - if (machine != null) - { - machine.DiagnosticsDataAvailable -= Machine_DiagnosticsDataAvailable; - machine.DiagnosticsDataAvailable += Machine_DiagnosticsDataAvailable; - } - } - - private void Machine_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse data) - { - foreach (var prop in data.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) - { - IOVM controller = _controllers.SingleOrDefault(x => x.IO.Name == prop.Name); - - if (controller != null) - { - if (!controller.IO.MultiChannel) - { - RepeatedField arr = prop.GetValue(data) as RepeatedField; - controller.Value = arr.Last(); - } - else - { - //DoubleArray[] arrayOfDoubles = Enumerable.ToArray(prop.GetValue(data) as IEnumerable); - //(controller as GraphMultiController).PushData(arrayOfDoubles.Select(x => x.Data.ToList()).ToList()); - } - } - } - } - - public void OnDropAvailableIO(IOVM ioVM) - { - Controllers.Add(ioVM); - AvailableControllers.Remove(ioVM); - } - } -} -- cgit v1.3.1