4f0e718501
- Aggiunta finestra speciale per GunStock.
75 lines
2.0 KiB
VB.net
75 lines
2.0 KiB
VB.net
Imports System.ComponentModel
|
|
Imports EgtUILib
|
|
|
|
Public Class GunStockParamListItem
|
|
Implements INotifyPropertyChanged
|
|
|
|
Private m_ValidateList As Action
|
|
|
|
Private m_Name As String
|
|
Public ReadOnly Property Name As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Value As String
|
|
Public Property Value As String
|
|
Get
|
|
Return m_Value
|
|
End Get
|
|
Set(value As String)
|
|
m_Value = value
|
|
GetValidationError("Value")
|
|
m_ValidateList()
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Min As Double = 0
|
|
|
|
Private m_Max As Double = 0
|
|
|
|
Private m_Error As String
|
|
Public ReadOnly Property ErrorMsg As String
|
|
Get
|
|
Return m_Error
|
|
End Get
|
|
End Property
|
|
|
|
Sub New(sName As String, dValue As Double, dMin As Double, dMax As Double, ValidateList As Action)
|
|
m_Name = sName
|
|
m_Min = dMin
|
|
m_Max = dMax
|
|
m_ValidateList = ValidateList
|
|
Value = DoubleToString(dValue, 4)
|
|
End Sub
|
|
|
|
Private Sub GetValidationError(ByVal propertyName As String)
|
|
Select Case propertyName
|
|
Case "Value"
|
|
Me.ValidateValue()
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub ValidateValue()
|
|
m_Error = String.Empty
|
|
If String.IsNullOrEmpty(m_Value) Then
|
|
m_Error = m_Name & " " & EgtMsg(MSG_GUNSTOCK + 4)
|
|
Else
|
|
Dim dVal As Double = 0
|
|
StringToDouble(m_Value, dVal)
|
|
If Not (dVal > m_Min - EPS_SMALL And dVal < m_Max + EPS_SMALL) Then
|
|
m_Error = EgtMsg(MSG_GUNSTOCK + 5) & " " & m_Min & " " & EgtMsg(MSG_GUNSTOCK + 6) & " " & m_Max & "."
|
|
End If
|
|
End If
|
|
NotifyPropertyChanged("ErrorMsg")
|
|
End Sub
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class
|