aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-15 13:22:53 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-15 13:22:53 +0300
commitc6b01f3e683b83fb0d6bf080efbd24a9a732b9f5 (patch)
tree900238695f8c1e0e2ea1f5786e3b847fcfa1ba43 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
parentdf9b2580669472d446e109dff88bdfa247b23b1e (diff)
downloadTango-c6b01f3e683b83fb0d6bf080efbd24a9a732b9f5.tar.gz
Tango-c6b01f3e683b83fb0d6bf080efbd24a9a732b9f5.zip
Implemented process parameters item on machine studio tech board.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs46
1 files changed, 45 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
index 381101c7e..41fff94d9 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
@@ -52,7 +52,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
private DateTime _lastDiagnosticsResponseUpdate;
private const int MIN_DIAGNOSTICS_UPDATE_MILI = 500;
private TechnicianModuleSettings _settings;
-
+
#region Properties
@@ -535,6 +535,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
{
CreateElement<SpeedSensorElementEditor, SpeedSensorItem, HardwareSpeedSensorType>(bounds, Adapter.HardwareSpeedSensorTypes.FirstOrDefault());
}
+ else if (item is ProcessParametersItem)
+ {
+ var editor = CreateElement<ProcessParametersElementEditor, ProcessParametersItem, object>(bounds, null);
+ InitProcessParameterItem(editor.ProcessParametersItem);
+ }
}
/// <summary>
@@ -654,6 +659,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
(item as SpeedSensorItem).HardwareSpeedSensorType = Adapter.HardwareSpeedSensorTypes.FirstOrDefault(x => x.Guid == item.ItemGuid);
CreateElement<SpeedSensorElementEditor>(item);
}
+ else if (item is ProcessParametersItem)
+ {
+ var editor = CreateElement<ProcessParametersElementEditor>(item);
+ InitProcessParameterItem(editor.ProcessParametersItem);
+ }
}
/// <summary>
@@ -1139,6 +1149,40 @@ namespace Tango.MachineStudio.Technician.ViewModels
}
/// <summary>
+ /// Initializes the process parameter item.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ private void InitProcessParameterItem(ProcessParametersItem item)
+ {
+ item.PushParametersPressed += async (x, parameters) =>
+ {
+ try
+ {
+ CheckMachineOperator();
+
+ using (_notification.PushTaskItem("Uploading process parameters..."))
+ {
+ try
+ {
+ await MachineOperator.UploadProcessParameters(parameters);
+ }
+ catch (Exception ex)
+ {
+ String msg = "Error uploading process parameters:" + Environment.NewLine + parameters.ToJsonString();
+ _eventLogger.Log(ex,msg);
+ LogManager.Log(ex, msg);
+ _notification.ShowError("Could not upload process parameters." + Environment.NewLine + ex.Message);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError(ex.Message);
+ }
+ };
+ }
+
+ /// <summary>
/// Checks the machine operator.
/// </summary>
/// <exception cref="InvalidOperationException">No machine connected.</exception>