diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-16 12:57:23 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-16 12:57:23 +0200 |
| commit | c5dba8cec3db88733ee8e1c206c518e27974f867 (patch) | |
| tree | fa005915dfa442dbf33a61742f7f918e8e8a2926 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels | |
| parent | 0fda2ba3ff49bdc1ffc6833f658e2164af187008 (diff) | |
| download | Tango-c5dba8cec3db88733ee8e1c206c518e27974f867.tar.gz Tango-c5dba8cec3db88733ee8e1c206c518e27974f867.zip | |
Added code comments for:
MachineStudio.Technician.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels')
2 files changed, 84 insertions, 29 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs index 68852fe20..306f15c5c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs @@ -9,12 +9,20 @@ using Tango.SharedUI; namespace Tango.MachineStudio.Technician.ViewModels { + /// <summary> + /// Represents the technician module main view, view model. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> public class MainViewVM : ViewModel { private TechNavigationManager _navigation; #region Constructors + /// <summary> + /// Initializes a new instance of the <see cref="MainViewVM"/> class. + /// </summary> + /// <param name="navigationManager">The navigation manager.</param> public MainViewVM(TechNavigationManager navigationManager) { _navigation = navigationManager; @@ -25,12 +33,19 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Commands + /// <summary> + /// Gets or sets the navigate to view command. + /// </summary> public RelayCommand<String> NavigateToViewCommand { get; set; } #endregion #region Private Methods + /// <summary> + /// Navigates to the specified view. + /// </summary> + /// <param name="view">The view.</param> private void NavigateToView(string view) { _navigation.NavigateTo((TechNavigationView)Enum.Parse(typeof(TechNavigationView), view, true)); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs index cb3114f4c..5b28916ec 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs @@ -14,19 +14,58 @@ using Tango.SharedUI; namespace Tango.MachineStudio.Technician.ViewModels { + /// <summary> + /// Represents the technician module sensors view, view model. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> public class SensorsViewVM : ViewModel { private List<GraphControllerBase> _controllers; + #region Properties + + /// <summary> + /// Gets or sets the application manager. + /// </summary> public IStudioApplicationManager ApplicationManager { get; set; } private IMachineOperator _machineOperator; + /// <summary> + /// Gets or sets the machine operator. + /// </summary> public IMachineOperator MachineOperator { get { return _machineOperator; } set { _machineOperator = value; RaisePropertyChangedAuto(); } } + private int _graphSeconds; + /// <summary> + /// Gets or sets the graphs number of seconds to complete FIFO capacity. + /// </summary> + public int GraphSeconds + { + get { return _graphSeconds; } + set { _graphSeconds = value; RaisePropertyChanged(nameof(GraphSeconds)); } + } + + /// <summary> + /// Clears the graphs. + /// </summary> + public void ClearGraphs() + { + _controllers.ForEach(x => x.Clear()); + } + + #endregion + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="SensorsViewVM"/> class. + /// </summary> + /// <param name="applicationManager">The application manager.</param> + /// <param name="moduleLoader">The module loader.</param> public SensorsViewVM(IStudioApplicationManager applicationManager, IStudioModuleLoader moduleLoader) { ApplicationManager = applicationManager; @@ -56,22 +95,49 @@ namespace Tango.MachineStudio.Technician.ViewModels } } + #endregion + + #region Event Handlers + + /// <summary> + /// Handles the technician module IsLoaded changed event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="loaded">if set to <c>true</c> [loaded].</param> private void Module_IsLoadedChanged(object sender, bool loaded) { - //_controllers.ForEach(x => x.ChangeRenderMode(loaded)); + _controllers.ForEach(x => x.ChangeRenderMode(loaded)); } + /// <summary> + /// Handles the application manager connected machine changed event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="machineOperator">The machine operator.</param> private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machineOperator) { InitializeConnectedMachine(machineOperator); } + /// <summary> + /// Handles the machine operator sensors data available event + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="data">The data.</param> private void MachineOperator_SensorsDataAvailable(object sender, PushSensorsResponse data) { TemperatureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray()); PressureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray()); } + #endregion + + #region Private Methods + + /// <summary> + /// Initializes the connected machine. + /// </summary> + /// <param name="machineOperator">The machine operator.</param> private void InitializeConnectedMachine(IMachineOperator machineOperator) { MachineOperator = machineOperator; @@ -84,6 +150,8 @@ namespace Tango.MachineStudio.Technician.ViewModels } } + #endregion + #region Graphs Controllers private GraphController _temperatureController; @@ -107,33 +175,5 @@ namespace Tango.MachineStudio.Technician.ViewModels } #endregion - - private int _graphSeconds; - /// <summary> - /// Gets or sets the graphs number of seconds to complete FIFO capacity. - /// </summary> - public int GraphSeconds - { - get { return _graphSeconds; } - set { _graphSeconds = value; RaisePropertyChanged(nameof(GraphSeconds)); } - } - - /// <summary> - /// Clears the graphs. - /// </summary> - public void ClearGraphs() - { - _controllers.ForEach(x => x.Clear()); - } - - /// <summary> - /// Creates a dummy list with default value of -1000 (used to fill graphs buffer). - /// </summary> - /// <param name="count">List length.</param> - /// <returns></returns> - private List<double> CreateDummyList(int count) - { - return Enumerable.Repeat<double>(-1000, count + 1).ToList(); - } } } |
