From b84ea5c89946d6e21ffa72f913cab3bec5f1d5c6 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 7 Feb 2018 16:23:25 +0200 Subject: Filter available graphs by IO Type. --- .../ViewModels/MainViewVM.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') 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 100880cec..cf3cbab7d 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.Integration.Observables.Enumerations; namespace Tango.MachineStudio.Developer.ViewModels { @@ -209,14 +210,14 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _isSideBarOpened = value; RaisePropertyChangedAuto(); } } - private ObservableCollection _availableSensors; + private ObservableCollection _availableGraphs; /// /// Gets or sets the available sensors. /// - public ObservableCollection AvailableSensors + public ObservableCollection AvailableGraphs { - get { return _availableSensors; } - set { _availableSensors = value; RaisePropertyChangedAuto(); } + get { return _availableGraphs; } + set { _availableGraphs = value; RaisePropertyChangedAuto(); } } private ObservableCollection _graphs; @@ -475,7 +476,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (!this.DesignMode) { Adapter = ObservablesEntitiesAdapter.Instance; - AvailableSensors = Adapter.Ios.ToObservableCollection(); + AvailableGraphs = Adapter.Ios.Where(x => (IOType)x.Type == IOType.Input || (IOType)x.Type == IOType.InputOutput).ToObservableCollection(); } Graphs = new ObservableCollection(); @@ -1124,7 +1125,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Add sensor graph from available sensors to displayed graphs. /// /// The sensor. - public void OnDropAvailableSensor(Io sensor) + public void OnDropAvailableGraph(Io sensor) { if (Graphs.Count < 8) { @@ -1172,7 +1173,7 @@ namespace Tango.MachineStudio.Developer.ViewModels StartFullScreenGraph(sender as IRealTimeGraph); }; Graphs.Add(graphControl); - AvailableSensors.Remove(sensor); + AvailableGraphs.Remove(sensor); _controllers.Add(sensor.Name, controller); } @@ -1212,7 +1213,7 @@ namespace Tango.MachineStudio.Developer.ViewModels _controllers.Remove(sensor.Name); graph.InnerGraph.Dispose(); Graphs.Remove(graph); - AvailableSensors.Insert(0, sensor); + AvailableGraphs.Insert(0, sensor); } #endregion -- cgit v1.3.1