From c6b01f3e683b83fb0d6bf080efbd24a9a732b9f5 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 15 Jul 2018 13:22:53 +0300 Subject: Implemented process parameters item on machine studio tech board. --- .../ViewModels/MachineTechViewVM.cs | 46 +++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') 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(bounds, Adapter.HardwareSpeedSensorTypes.FirstOrDefault()); } + else if (item is ProcessParametersItem) + { + var editor = CreateElement(bounds, null); + InitProcessParameterItem(editor.ProcessParametersItem); + } } /// @@ -654,6 +659,11 @@ namespace Tango.MachineStudio.Technician.ViewModels (item as SpeedSensorItem).HardwareSpeedSensorType = Adapter.HardwareSpeedSensorTypes.FirstOrDefault(x => x.Guid == item.ItemGuid); CreateElement(item); } + else if (item is ProcessParametersItem) + { + var editor = CreateElement(item); + InitProcessParameterItem(editor.ProcessParametersItem); + } } /// @@ -1138,6 +1148,40 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } + /// + /// Initializes the process parameter item. + /// + /// The item. + 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); + } + }; + } + /// /// Checks the machine operator. /// -- cgit v1.3.1