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.. --- .../Tango.MachineStudio.Developer.csproj | 12 +-- .../ViewModelLocator.cs | 9 --- .../ViewModels/MainViewVM.cs | 13 +++ .../ViewModels/MonitoringViewVM.cs | 93 ---------------------- .../Views/MainView.xaml | 5 +- .../Views/MonitoringView.xaml | 76 ------------------ .../Views/MonitoringView.xaml.cs | 50 ------------ .../ViewModels/MachineTechViewVM.cs | 25 +++++- .../Views/MachineTechView.xaml | 4 +- 9 files changed, 43 insertions(+), 244 deletions(-) delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 722d8efe6..43ebc515d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -113,7 +113,6 @@ - MainView.xaml @@ -121,9 +120,6 @@ GlobalVersionInfo.cs - - MonitoringView.xaml - Designer MSBuild:Compile @@ -136,10 +132,6 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - @@ -227,6 +219,10 @@ {d0ce8122-077d-42a2-9490-028ae4769b52} Tango.MachineStudio.MachineDesigner + + {5d39c1e1-3ecd-4634-bd1b-2bcf71c54a15} + Tango.MachineStudio.Technician + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs index 200c89e19..46c7ecf00 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs @@ -21,7 +21,6 @@ namespace Tango.MachineStudio.Developer SimpleIoc.Default.Register(() => MainView.Self); SimpleIoc.Default.Register(); - SimpleIoc.Default.Register(); } public static MainViewVM MainViewVM @@ -31,13 +30,5 @@ namespace Tango.MachineStudio.Developer return ServiceLocator.Current.GetInstance(); } } - - public static MonitoringViewVM MonitoringViewVM - { - get - { - return ServiceLocator.Current.GetInstance(); - } - } } } \ No newline at end of file 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); - } - } -} 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 4cbae2941..cd5cdb8a2 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 @@ -7,6 +7,7 @@ xmlns:global="clr-namespace:Tango.MachineStudio.Developer" xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:techViews="clr-namespace:Tango.MachineStudio.Technician.Views;assembly=Tango.MachineStudio.Technician" 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" @@ -1988,7 +1989,7 @@ - + @@ -2147,7 +2148,7 @@ -