diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-02-11 21:46:22 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-02-11 21:46:22 +0200 |
| commit | a84ca3e4bee123600c08f8897eca5be83b3ffcf8 (patch) | |
| tree | cccdce1734f55c0647b5c19c1fcc733be92ddbf6 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels | |
| parent | a801f688bde7b6c75f47ca4ebd2991271c521d34 (diff) | |
| download | Tango-a84ca3e4bee123600c08f8897eca5be83b3ffcf8.tar.gz Tango-a84ca3e4bee123600c08f8897eca5be83b3ffcf8.zip | |
Added TechView for Developer..
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels')
2 files changed, 13 insertions, 93 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 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; + /// <summary> + /// Gets or sets the machine tech view models. + /// </summary> + 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<CaptureDevice>(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<IOVM> _availableControllers; - public ObservableCollection<IOVM> AvailableControllers - { - get { return _availableControllers; } - set { _availableControllers = value; } - } - - private ObservableCollection<IOVM> _controllers; - public ObservableCollection<IOVM> 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<IOVM>(); - } - - 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<double> arr = prop.GetValue(data) as RepeatedField<double>; - controller.Value = arr.Last(); - } - else - { - //DoubleArray[] arrayOfDoubles = Enumerable.ToArray(prop.GetValue(data) as IEnumerable<DoubleArray>); - //(controller as GraphMultiController).PushData(arrayOfDoubles.Select(x => x.Data.ToList()).ToList()); - } - } - } - } - - public void OnDropAvailableIO(IOVM ioVM) - { - Controllers.Add(ioVM); - AvailableControllers.Remove(ioVM); - } - } -} |
