From 94b83ea6d7e62534219801dcf1d53ee6e187837d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 20 Sep 2018 17:48:52 +0300 Subject: Implemented reset process parameters from research module. --- .../ViewModels/MainViewVM.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels') 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 bf6a6ecbc..ff4f47471 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 @@ -657,6 +657,12 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Gets or sets to running job command. /// public RelayCommand ToRunningJobCommand { get; set; } + + /// + /// Gets or sets the reset process parameters command. + /// + public RelayCommand ResetProcessParametersCommand { get; set; } + #endregion #region Constructors @@ -713,6 +719,7 @@ namespace Tango.MachineStudio.Developer.ViewModels ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null && CanWork); DisplayJobEmbroideryFileCommand = new RelayCommand(DisplayJobEmbroideryFile, () => CanWork); ReloadMachinesCommand = new RelayCommand(() => LoadMachine(), () => CanWork && SelectedMachine != null); + ResetProcessParametersCommand = new RelayCommand(ResetProcessParameters); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; @@ -1491,6 +1498,29 @@ namespace Tango.MachineStudio.Developer.ViewModels CanWork = true; } + /// + /// Resets the process parameters. + /// + private async void ResetProcessParameters() + { + if (_notification.ShowQuestion("This will reset the process parameters. Are you sure?")) + { + using (_notification.PushTaskItem("Resetting process parameters...")) + { + try + { + await ApplicationManager.ConnectedMachine.UploadProcessParameters(new ProcessParametersTable()); + _notification.ShowInfo("Heaters are turned off."); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error resetting process parameters."); + _notification.ShowError("Error resetting process parameters." + Environment.NewLine + ex.Message); + } + } + } + } + #endregion #region Active Job Management -- cgit v1.3.1