From fcce49aec07952eeb60cc6b33b90a8e493c85254 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 21 Jul 2020 16:37:15 +0300 Subject: Deleted unnecessary allocation memory, handle error message Related Work Items: #2957 --- .../ViewModels/ColorCalibrationViewVM.cs | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs index d065b58c5..7d05897d5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs @@ -222,10 +222,10 @@ namespace Tango.MachineStudio.RML.ViewModels conversionInput.TargetB = lab.B; } CalibrationOutput result = _calibrator.GetLiquidFactor(conversionInput); - - ErrorMessage = Regex.Replace(result.ErrorMessage, "[^A-Za-z0-9_., ]+", ""); - + + ErrorMessage = result.ErrorMessage; HasError = false == String.IsNullOrEmpty(ErrorMessage); + return result.LiquidFactor; } catch (Exception ex ) @@ -309,6 +309,11 @@ namespace Tango.MachineStudio.RML.ViewModels LinearizationPlotControl.InvalidatePlot(true); } + + /// + /// Open file dialog and get name of file + /// + /// private String GetInkDataFileOpen() { OpenFileDialog dlg = new OpenFileDialog(); @@ -321,6 +326,7 @@ namespace Tango.MachineStudio.RML.ViewModels return null; } + private List GetLinearizationMeasurements(List items) { try @@ -338,23 +344,24 @@ namespace Tango.MachineStudio.RML.ViewModels } LinearizationOutput result = _linearizationMeasurementscalibrator.GetLinearizationMeasurements(linearizationInput); - ErrorMessage = Regex.Replace(result.ErrorMessage, "[^A-Za-z0-9_., ]+", ""); - - HasError = false == String.IsNullOrEmpty(ErrorMessage); + if(!String.IsNullOrEmpty(result.ErrorMessage)) + { + LogManager.Log(result.ErrorMessage, "Error occurred while trying to call GetLinearizationMeasurements."); + } return result.InkPercentage.ToList(); } catch (Exception ex) { - HasError = true; - ErrorMessage = "Error occurred while trying to call GetLiquidFactor."; - LogManager.Log(ex, "Error occurred while trying to call GetLiquidFactor."); + LogManager.Log(ex, "Error occurred while trying to call GetLinearizationMeasurements."); } return null; } #endregion - #region Export graph - + #region Export graph + /// + /// Exports the graph point to Excel file. + /// protected void ExportGraph() { SaveFileDialog dlg = new SaveFileDialog(); -- cgit v1.3.1