From f5206ce8bf149d57ee2a04dda394774e629be55f Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Wed, 29 Mar 2023 16:26:48 +0200 Subject: [PATCH] - aggiunta possibilita' di impostare min e max per parametri di lavorazione --- Icarus/Constants/ConstIni.vb | 2 ++ Icarus/CurrMachiningPanel/CurrMachining.vb | 12 +++++++-- Icarus/MachiningDb/Machining.vb | 29 ++++++++++++++++++++-- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/Icarus/Constants/ConstIni.vb b/Icarus/Constants/ConstIni.vb index c3717ea..a2422ec 100644 --- a/Icarus/Constants/ConstIni.vb +++ b/Icarus/Constants/ConstIni.vb @@ -122,6 +122,8 @@ Public Module ConstIni Public Const K_CLR_MACHSTART As String = "MachStart" Public Const K_CLR_OTHERS As String = "Others" + Public Const S_MINMAX As String = "MinMax" + Public Const S_MRUFILES As String = "MruFiles" Public Const S_MRUIMPORTFILES As String = "MruImportFiles" diff --git a/Icarus/CurrMachiningPanel/CurrMachining.vb b/Icarus/CurrMachiningPanel/CurrMachining.vb index afe57de..723d3d5 100644 --- a/Icarus/CurrMachiningPanel/CurrMachining.vb +++ b/Icarus/CurrMachiningPanel/CurrMachining.vb @@ -292,10 +292,18 @@ Public Class CurrNumericMachiningParam Return If(m_bIsLen, LenToString(m_dValue, 1), DoubleToString(m_dValue, 2)) End Get Set(value As String) + Dim dTempValue As Double = 0 If m_bIsLen Then - StringToLen(value, m_dValue) + StringToLen(value, dTempValue) Else - StringToDouble(value, m_dValue) + StringToDouble(value, dTempValue) + End If + If m_bIsActiveMinMax Then + If dTempValue >= m_dMinValue AndAlso dTempValue <= m_dMaxValue Then + m_dValue = dTempValue + End If + Else + m_dValue = dTempValue End If NotifyPropertyChanged(NameOf(sValue)) NotifyPropertyChanged(NameOf(bIsModifiedFromDb)) diff --git a/Icarus/MachiningDb/Machining.vb b/Icarus/MachiningDb/Machining.vb index 9707b47..a679690 100644 --- a/Icarus/MachiningDb/Machining.vb +++ b/Icarus/MachiningDb/Machining.vb @@ -644,6 +644,10 @@ Public Class NumericMachiningParam Protected m_bIsLen As Boolean = False + Protected m_bIsActiveMinMax As Boolean = False + Protected m_dMinValue As Double + Protected m_dMaxValue As Double + Protected m_dValue As Double Public ReadOnly Property dValue As Double Get @@ -655,10 +659,18 @@ Public Class NumericMachiningParam Return If(m_bIsLen, LenToString(m_dValue, 1), DoubleToString(m_dValue, 2)) End Get Set(value As String) + Dim dTempValue As Double = 0 If m_bIsLen Then - StringToLen(value, m_dValue) + StringToLen(value, dTempValue) Else - StringToDouble(value, m_dValue) + StringToDouble(value, dTempValue) + End If + If m_bIsActiveMinMax Then + If dTempValue >= m_dMinValue AndAlso dTempValue <= m_dMaxValue Then + m_dValue = dTempValue + End If + Else + m_dValue = dTempValue End If NotifyPropertyChanged(NameOf(sValue)) End Set @@ -683,6 +695,19 @@ Public Class NumericMachiningParam Sub New(Type As Params, nIndex As Integer) MyBase.New(Type) + ' leggo ed imposto eventuali min e max + Dim sMinMax As String = "" + If GetMainPrivateProfileString(S_MINMAX, Type, "", sMinMax) > 0 Then + Dim sMinMaxValues() As String = sMinMax.Split(","c) + Dim dMin As Double = 0 + Dim dMax As Double = 0 + If StringToDouble(sMinMaxValues(0), dMin) AndAlso StringToDouble(sMinMaxValues(1), dMax) Then + m_dMinValue = dMin + m_dMaxValue = dMax + m_bIsActiveMinMax = True + End If + End If + ' leggo parametri da Db If nIndex = 0 Then m_dValue = 0 m_bIsLen = True