aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-01-16 12:57:23 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-01-16 12:57:23 +0200
commitc5dba8cec3db88733ee8e1c206c518e27974f867 (patch)
treefa005915dfa442dbf33a61742f7f918e8e8a2926 /Software/Visual_Studio/MachineStudio/Modules
parent0fda2ba3ff49bdc1ffc6833f658e2164af187008 (diff)
downloadTango-c5dba8cec3db88733ee8e1c206c518e27974f867.tar.gz
Tango-c5dba8cec3db88733ee8e1c206c518e27974f867.zip
Added code comments for:
MachineStudio.Technician.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs34
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs26
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs32
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs15
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs98
9 files changed, 165 insertions, 58 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs
index 3120c44a6..9bd0e16ad 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs
@@ -7,12 +7,16 @@ using System.Windows.Data;
namespace Tango.MachineStudio.Technician.Converters
{
+ /// <summary>
+ /// Converts number of seconds to graph FIFO capacity.
+ /// </summary>
+ /// <seealso cref="System.Windows.Data.IValueConverter" />
public class SecondsToGraphPointsConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double arrLength = double.Parse(parameter.ToString());
- return Helpers.GraphsMaxPointsHelper.GetMaxPoints(arrLength);
+ return Helpers.GraphsHelper.GetMaxPoints(arrLength);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs
new file mode 100644
index 000000000..78466ace8
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Settings;
+
+namespace Tango.MachineStudio.Technician.Helpers
+{
+ /// <summary>
+ /// Contains RealTimeGraphEx helper methods.
+ /// </summary>
+ public static class GraphsHelper
+ {
+ /// <summary>
+ /// Gets the maximum points graph points by correlating between seconds duration from settings and expected graph points per frame.
+ /// </summary>
+ /// <param name="pointsPerFrame">Length of graph points per frame.</param>
+ /// <returns></returns>
+ public static int GetMaxPoints(double pointsPerFrame)
+ {
+ try
+ {
+ double seconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration;
+ double pullRate = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsPullingInterval;
+ return (int)(((pullRate * pointsPerFrame * 10 * seconds) * (10 / pullRate)) * 0.65);
+ }
+ catch (Exception)
+ {
+ return 300;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs
deleted file mode 100644
index 87aab5967..000000000
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.Settings;
-
-namespace Tango.MachineStudio.Technician.Helpers
-{
- public static class GraphsMaxPointsHelper
- {
- public static int GetMaxPoints(double arrLength)
- {
- try
- {
- double seconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration;
- double pullRate = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsPullingInterval;
- return (int)(((pullRate * arrLength * 10 * seconds) * (10 / pullRate)) * 0.65);
- }
- catch (Exception)
- {
- return 300;
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs
index f473776d1..ddfb84920 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs
@@ -7,8 +7,15 @@ using Tango.MachineStudio.Technician.Views;
namespace Tango.MachineStudio.Technician.Navigation
{
+ /// <summary>
+ /// Represents the technician module navigation manager.
+ /// </summary>
public class TechNavigationManager
{
+ /// <summary>
+ /// Navigates to the specified view.
+ /// </summary>
+ /// <param name="view">The view.</param>
public void NavigateTo(TechNavigationView view)
{
MainView.Instance.TransitionControl.AutoNavigate(view.ToString());
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs
index 27d9fb09b..b4a85f92a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs
@@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace Tango.MachineStudio.Technician.Navigation
{
+ /// <summary>
+ /// Represents the available technician module views.
+ /// </summary>
public enum TechNavigationView
{
Overview,
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
index 097917fef..62da02f50 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
@@ -79,7 +79,7 @@
<ItemGroup>
<Compile Include="Converters\SecondsToGraphPointsConverter.cs" />
<Compile Include="Converters\TransitionLinkConverter.cs" />
- <Compile Include="Helpers\GraphsMaxPointsHelper.cs" />
+ <Compile Include="Helpers\GraphsHelper.cs" />
<Compile Include="Navigation\TechNavigationView.cs" />
<Compile Include="Navigation\TechNavigationManager.cs" />
<Compile Include="TechnicianModule.cs" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs
index b715b6710..4d211acf1 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs
@@ -12,22 +12,47 @@ using Tango.SharedUI.Helpers;
namespace Tango.MachineStudio.Technician
{
+ /// <summary>
+ /// Represents a machine studio technician module.
+ /// </summary>
+ /// <seealso cref="Tango.MachineStudio.Common.IStudioModule" />
public class TechnicianModule : IStudioModule
{
private bool _isLoaded;
+ /// <summary>
+ /// Occurs when the module IsLoaded property has changed.
+ /// </summary>
public event EventHandler<bool> IsLoadedChanged;
+ /// <summary>
+ /// Gets the module name.
+ /// </summary>
public string Name => "Technician";
+ /// <summary>
+ /// Gets the module description.
+ /// </summary>
public string Description => "Provides access to low level machine components by exposing diagnostics and profiling tools.";
+ /// <summary>
+ /// Gets the module cover image.
+ /// </summary>
public BitmapSource Image => ResourceHelper.GetImageFromResources("Images/technician.jpg");
+ /// <summary>
+ /// Gets the module entry point view.
+ /// </summary>
public FrameworkElement MainView => new MainView();
+ /// <summary>
+ /// Gets the permission required to see and load this module.
+ /// </summary>
public Permissions Permission => Permissions.RunTechnicianModule;
+ /// <summary>
+ /// Gets a value indicating whether this module has been initialized.
+ /// </summary>
public bool IsInitialized => true;
/// <summary>
@@ -39,12 +64,17 @@ namespace Tango.MachineStudio.Technician
set { _isLoaded = value; IsLoadedChanged?.Invoke(this, value); }
}
-
+ /// <summary>
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+ /// </summary>
public void Dispose()
{
}
+ /// <summary>
+ /// Perform any operations required to initialize this module.
+ /// </summary>
public void Initialize()
{
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();
- }
}
}