8f5ef91890
- controlli vari.
829 lines
30 KiB
VB.net
829 lines
30 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.Windows.Forms
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class OptionWindowVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private m_LanguageList As New List(Of Language)
|
|
Public ReadOnly Property LanguageList As List(Of Language)
|
|
Get
|
|
Return m_LanguageList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SelLanguage As Language
|
|
Public Property SelLanguage As Language
|
|
Get
|
|
Return m_SelLanguage
|
|
End Get
|
|
Set(value As Language)
|
|
If value IsNot m_SelLanguage Then
|
|
m_SelLanguage = value
|
|
WriteMainPrivateProfileString(S_GENERAL, K_MESSAGES, m_SelLanguage.Name)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MeasureUnitList As New List(Of String)({"inch", "mm"})
|
|
Public ReadOnly Property MeasureUnitList As List(Of String)
|
|
Get
|
|
Return m_MeasureUnitList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SideModeList As List(Of String)
|
|
Public ReadOnly Property SideModeList As List(Of String)
|
|
Get
|
|
Return m_SideModeList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SelSideModeIndex As Integer
|
|
Public Property SelSideModeIndex As Integer
|
|
Get
|
|
Return m_SelSideModeIndex
|
|
End Get
|
|
Set(value As Integer)
|
|
If value <> m_SelSideModeIndex Then
|
|
m_SelSideModeIndex = value
|
|
WriteMainPrivateProfileString(S_COMPO, K_SIDEMODE, m_SelSideModeIndex.ToString())
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property SelMeasureUnit As Integer
|
|
Get
|
|
Return If(EgtUiUnitsAreMM(), MeasureUnitOpt.MM, MeasureUnitOpt.INCH)
|
|
End Get
|
|
Set(value As Integer)
|
|
' salvo unità di misura precedente
|
|
Dim PrevMeasureUnit As MeasureUnitOpt = If(EgtUiUnitsAreMM(), MeasureUnitOpt.MM, MeasureUnitOpt.INCH)
|
|
If value <> PrevMeasureUnit Then
|
|
' cambio unità di misura
|
|
EgtSetUiUnits(DirectCast(value, MeasureUnitOpt) = MeasureUnitOpt.MM)
|
|
OmagOFFICEMap.refStatusBarVM.SetMeasureUnit(value)
|
|
WriteMainPrivateProfileString(S_GENERAL, K_MMUNITS, value.ToString())
|
|
' aggiorno le unità di misura nelle Tab
|
|
OmagOFFICEMap.refRawPartTabVM.Refresh(PrevMeasureUnit)
|
|
OmagOFFICEMap.refNestingTabVM.Refresh(PrevMeasureUnit)
|
|
OmagOFFICEMap.refMoveRawModeVM.Refresh(PrevMeasureUnit)
|
|
If Not IsNothing(OmagOFFICEMap.refSimulTabVM.MySimul) Then OmagOFFICEMap.refSimulTabVM.MySimul.Refresh(PrevMeasureUnit)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property DIGeneral As Boolean
|
|
Get
|
|
Return (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0)
|
|
End Get
|
|
Set(value As Boolean)
|
|
WriteMainPrivateProfileString(S_NEST, K_DIRECT, If(value, "1", "0"))
|
|
End Set
|
|
End Property
|
|
|
|
Public Property DICsv As Boolean
|
|
Get
|
|
Return GetMainPrivateProfileInt(S_CSV, K_CSVDIRECT, 1) <> 0
|
|
End Get
|
|
Set(value As Boolean)
|
|
WriteMainPrivateProfileString(S_CSV, K_CSVDIRECT, If(value, "1", "0"))
|
|
End Set
|
|
End Property
|
|
|
|
' lista dei colori per SideAngle
|
|
Private m_ColorItemList As New ObservableCollection(Of ColorLsBxItem)
|
|
Public ReadOnly Property ColorItemList As ObservableCollection(Of ColorLsBxItem)
|
|
Get
|
|
Return m_ColorItemList
|
|
End Get
|
|
End Property
|
|
|
|
'lista dei colori per Engrave
|
|
Private m_ColorEngraveItemList As New ObservableCollection(Of ColorLsEngraveBxItem)
|
|
Public ReadOnly Property ColorEngraveItemList As ObservableCollection(Of ColorLsEngraveBxItem)
|
|
Get
|
|
Return m_ColorEngraveItemList
|
|
End Get
|
|
End Property
|
|
|
|
Private Property m_TextColorBackground As Color3d
|
|
Public ReadOnly Property TextColorBackground As Brush
|
|
Get
|
|
Dim x = New SolidColorBrush( Color.FromArgb( CByte( m_TextColorBackground.A / 100 * 255),
|
|
CByte( m_TextColorBackground.R),
|
|
CByte( m_TextColorBackground.G),
|
|
CByte( m_TextColorBackground.B)))
|
|
Return x
|
|
End Get
|
|
'Set(value As Brush)
|
|
' If Not value.Equals(m_TextColorBackground) Then
|
|
' m_TextColorBackground = value
|
|
' NotifyPropertyChanged("TextColorBackground")
|
|
' End If
|
|
'End Set
|
|
End Property
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property Title As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 1)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CurrentLanguageMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 1)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property LanguageAdvertMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 2)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MeasureUnitMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 3)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TextColorMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 13)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ColorToSideAngMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 19)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CTSAboxEnableMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 20)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ToleranceMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 21)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TalloneMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 22)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property InclinazioneMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 23)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property SideAngleHdr As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 5)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DirectInsertHdr As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 8)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DIGeneralMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 9)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DICsvMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 10)
|
|
End Get
|
|
End Property
|
|
|
|
' Engrave from color
|
|
Public ReadOnly Property ColorToEngraveMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 26)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property CTEboxEnableMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 20)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ToleranceEMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 21)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property AffondamentoMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 27)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property LarghezzaMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPTIONSPAGEUC + 28)
|
|
End Get
|
|
End Property
|
|
|
|
'Definizione comandi
|
|
Private m_cmdChangeColor As ICommand
|
|
|
|
#End Region
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Leggo nome lingua corrente
|
|
Dim sLanguage As String = String.Empty
|
|
GetMainPrivateProfileString(S_GENERAL, K_MESSAGES, "", sLanguage)
|
|
' Leggo elenco lingue disponibili da file ini e imposto lingua corrente
|
|
Dim nIndex As Integer = 1
|
|
While True
|
|
Dim ReadLanguage As Language = GetMainPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
|
|
If IsNothing(ReadLanguage) Then Exit While
|
|
m_LanguageList.Add(ReadLanguage)
|
|
If String.Compare(ReadLanguage.Name, sLanguage, True) = 0 Then
|
|
m_SelLanguage = ReadLanguage
|
|
End If
|
|
nIndex += 1
|
|
End While
|
|
' Carico messaggi per lista tipologie di definizione angolo d'inclinazione
|
|
m_SideModeList = New List(Of String)({EgtMsg(MSG_OPTIONSPAGEUC + 6), EgtMsg(MSG_OPTIONSPAGEUC + 7)})
|
|
' Carico valore da file ini
|
|
m_SelSideModeIndex = GetMainPrivateProfileInt(S_COMPO, K_SIDEMODE, 0)
|
|
|
|
Dim m_OptionWindowV As OptionWindowV = DirectCast(Application.Current.Windows.OfType(Of OptionWindowV)().SingleOrDefault(), OptionWindowV)
|
|
|
|
' I parametri di TextColor presenti nell'INI vengono caricati
|
|
Dim sTextColor As String = " "
|
|
If GetPrivateProfileString(S_NEST, K_TEXTCOLOR, " ", sTextColor, m_sIniFile) <> 0 Then
|
|
Dim sTextColorArray() As String = sTextColor.Split(","c)
|
|
If sTextColorArray.Count() >= 3 Then
|
|
Dim nRed As Integer = 0 : StringToInt( sTextColorArray(0), nRed)
|
|
Dim nGreen As Integer = 0 : StringToInt( sTextColorArray(1), nGreen)
|
|
Dim nBlue As Integer = 0 : StringToInt( sTextColorArray(2), nBlue)
|
|
m_TextColorBackground = New Color3d( nRed, nGreen, nBlue)
|
|
Else
|
|
m_TextColorBackground = New Color3d( 0, 0, 0)
|
|
End If
|
|
End If
|
|
|
|
' Leggo se la modalità ColorToSideAng è abilitata
|
|
If GetPrivateProfileInt(S_COLORTOSIDEANG, K_CTSA_ENABLE, 0, m_sIniFile) <> 0 Then
|
|
CTSAChecked = True
|
|
Else
|
|
CTSAChecked = False
|
|
End If
|
|
|
|
' I parametri di ColorSideToAng presenti nell'INI vengono caricati a prescindere dall'abilitazione
|
|
Dim nVal As Integer
|
|
nVal = GetPrivateProfileInt(S_COLORTOSIDEANG, K_CTSA_TOLERANCE, nVal, m_sIniFile)
|
|
m_sToleranceTxBx = nVal.ToString()
|
|
' Nel caso dei colori singoli viene verificata la presenza della Key corrispondente a ciascuno dei
|
|
' 10 singoli colori (CTSAindex) e il Valore associato viene splittato in un array di stringhe
|
|
For index As Integer = 1 To 10
|
|
Dim sColor As String = " "
|
|
Dim sArray() As String
|
|
If GetPrivateProfileString(S_COLORTOSIDEANG, K_CTSA & index, " ", sColor, m_sIniFile) <> 0 Then
|
|
sArray = sColor.Split(","c)
|
|
Dim bIsActive As Boolean = If(sArray.Length >= 6, sArray(5).Equals("1"), True)
|
|
Dim nRed As Integer = 0 : StringToInt(If(sArray.Length >= 1, sArray(0), "0"), nRed)
|
|
Dim nGreen As Integer = 0 : StringToInt(If(sArray.Length >= 2, sArray(1), "0"), nGreen)
|
|
Dim nBlue As Integer = 0 : StringToInt(If(sArray.Length >= 3, sArray(2), "0"), nBlue)
|
|
Dim dSlant As Double = 0 : StringToDouble(If(sArray.Length >= 4, sArray(3), "0"), dSlant)
|
|
Dim dHeel As Double = 0 : StringToDouble(If(sArray.Length >= 5, sArray(4), "0"), dHeel)
|
|
' Leggo elenco colori disponibili da file ini
|
|
Dim ReadColor As ColorLsBxItem = New ColorLsBxItem(index,
|
|
bIsActive,
|
|
New Color3d(nRed, nGreen, nBlue, 100),
|
|
dSlant,
|
|
dHeel)
|
|
m_ColorItemList.Add(ReadColor)
|
|
Else
|
|
' Se CTSA di indice index non esiste nell'INI lo scrivo con dei valori di default e aggiungo ReadColor
|
|
' creato con i valori di default e indice index alla lista di colori
|
|
WritePrivateProfileString(S_COLORTOSIDEANG, K_CTSA & index, "255,255,255,0,0,0", m_sIniFile)
|
|
Dim ReadColor As ColorLsBxItem = New ColorLsBxItem(index, False, New Color3d(255, 255, 255, 100), 0, 0)
|
|
m_ColorItemList.Add(ReadColor)
|
|
End If
|
|
Next
|
|
|
|
' Leggo se la modalità ColorToEngrave è abilitata
|
|
If GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_ENABLE, 0, m_sIniFile) <> 0 Then
|
|
CTEChecked = True
|
|
Else
|
|
CTEChecked = False
|
|
End If
|
|
|
|
' I parametri di ColorSideToAng presenti nell'INI vengono caricati a prescindere dall'abilitazione
|
|
nVal = GetPrivateProfileInt(S_COLORTOENGRAVE, K_CTE_TOLERANCE, nVal, m_sIniFile)
|
|
m_sToleranceETxBx = nVal.ToString()
|
|
' Nel caso dei colori singoli viene verificata la presenza della Key corrispondente a ciascuno dei
|
|
' 10 singoli colori (CTSAindex) e il Valore associato viene splittato in un array di stringhe
|
|
For index As Integer = 1 To 10
|
|
Dim sColor As String = " "
|
|
Dim sArray() As String
|
|
If GetPrivateProfileString(S_COLORTOENGRAVE, K_CTE & index, " ", sColor, m_sIniFile) <> 0 Then
|
|
sArray = sColor.Split(","c)
|
|
Dim bIsActive As Boolean = If(sArray.Length >= 6, sArray(5).Equals("1"), True)
|
|
Dim nRed As Integer = 0 : StringToInt(If(sArray.Length >= 1, sArray(0), "0"), nRed)
|
|
Dim nGreen As Integer = 0 : StringToInt(If(sArray.Length >= 2, sArray(1), "0"), nGreen)
|
|
Dim nBlue As Integer = 0 : StringToInt(If(sArray.Length >= 3, sArray(2), "0"), nBlue)
|
|
Dim dAff As Double = 0 : StringToDouble(If(sArray.Length >= 4, sArray(3), "0"), dAff)
|
|
Dim dLar As Double = 0 : StringToDouble(If(sArray.Length >= 5, sArray(4), "0"), dLar)
|
|
' Leggo elenco colori disponibili da file ini
|
|
Dim ReadColor As ColorLsEngraveBxItem = New ColorLsEngraveBxItem(index,
|
|
bIsActive,
|
|
New Color3d(nRed, nGreen, nBlue, 100),
|
|
dAff,
|
|
dLar)
|
|
m_ColorEngraveItemList.Add(ReadColor)
|
|
Else
|
|
' Se CTSA di indice index non esiste nell'INI lo scrivo con dei valori di default e aggiungo ReadColor
|
|
' creato con i valori di default e indice index alla lista di colori
|
|
WritePrivateProfileString(S_COLORTOENGRAVE, K_CTE & index, "255,255,255,0,0,0", m_sIniFile)
|
|
Dim ReadColor As ColorLsEngraveBxItem = New ColorLsEngraveBxItem(index, False, New Color3d(255, 255, 255, 100), 0, 0)
|
|
m_ColorEngraveItemList.Add(ReadColor)
|
|
End If
|
|
Next
|
|
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "ChangeColorCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do ChangeColor.
|
|
''' </summary>
|
|
Public ReadOnly Property ChangeColorCommand As ICommand
|
|
Get
|
|
If m_cmdChangeColor Is Nothing Then
|
|
m_cmdChangeColor = New Command(AddressOf ChangeColor)
|
|
End If
|
|
Return m_cmdChangeColor
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the ChangeColor. This method is invoked by the ChangeColorCommand.
|
|
''' </summary>
|
|
Public Sub ChangeColor(ByVal param As Object)
|
|
'' Recupero colore da Ini
|
|
'Dim TextColor As New Color3d(192, 192, 192)
|
|
'Dim NewCol As New Color3d(192, 192, 192)
|
|
'GetPrivateProfileColor(S_NEST, K_TEXTCOLOR, TextColor, m_sIniFile)
|
|
'' Creo dialogo colori
|
|
'Dim ColorDlg As New System.Windows.Forms.ColorDialog
|
|
'ColorDlg.FullOpen = True
|
|
'ColorDlg.Color = TextColor.ToColor()
|
|
'' Visualizzo dialogo
|
|
'ColorDlg.ShowDialog()
|
|
'NewCol.FromColor(ColorDlg.Color)
|
|
'' Salvo eventuali modifiche al colore scelto
|
|
'Dim sColor As String = NewCol.R & "," & NewCol.G & "," & NewCol.B
|
|
'WritePrivateProfileString(S_NEST, K_TEXTCOLOR, sColor, m_sIniFile)
|
|
'' Imposto il colore scelto sul pulsante
|
|
'TextColorBackground = New SolidColorBrush(Color.FromRgb(NewCol.R, NewCol.G, NewCol.B))
|
|
|
|
' Recupero colore da Ini
|
|
Dim NewCol As New Color3d(192, 192, 192, 100)
|
|
' Creo dialogo colori
|
|
Dim ColorDlg As New System.Windows.Forms.ColorDialog
|
|
ColorDlg.FullOpen = True
|
|
ColorDlg.Color = m_TextColorBackground.ToColor()
|
|
' Visualizzo dialogo
|
|
If ColorDlg.ShowDialog() <> DialogResult.OK Then Return
|
|
NewCol.FromColor(ColorDlg.Color)
|
|
' Salvo eventuali modifiche al colore scelto
|
|
Dim sColor As String = NewCol.R & "," & NewCol.G & "," & NewCol.B
|
|
WritePrivateProfileString(S_NEST, K_TEXTCOLOR, sColor, m_sIniFile)
|
|
' Imposto il colore scelto sul pulsante
|
|
m_TextColorBackground = NewCol
|
|
NotifyPropertyChanged("TextColorBackground")
|
|
End Sub
|
|
|
|
#End Region ' ChangeColorCommand
|
|
|
|
#Region "Checked"
|
|
|
|
' SideAngle
|
|
Private Property m_CTSAChecked As Boolean
|
|
Public Property CTSAChecked As Boolean
|
|
Get
|
|
Return m_CTSAChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_CTSAChecked Then
|
|
m_CTSAChecked = value
|
|
If CTSAChecked = True Then
|
|
WritePrivateProfileString(S_COLORTOSIDEANG, K_CTSA_ENABLE, "1", m_sIniFile)
|
|
ElseIf CTSAChecked = False Then
|
|
WritePrivateProfileString(S_COLORTOSIDEANG, K_CTSA_ENABLE, "0", m_sIniFile)
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Engrave
|
|
Private Property m_CTEChecked As Boolean
|
|
Public Property CTEChecked As Boolean
|
|
Get
|
|
Return m_CTEChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_CTEChecked Then
|
|
m_CTEChecked = value
|
|
If CTEChecked = True Then
|
|
WritePrivateProfileString(S_COLORTOENGRAVE, K_CTE_ENABLE, "1", m_sIniFile)
|
|
ElseIf CTEChecked = False Then
|
|
WritePrivateProfileString(S_COLORTOENGRAVE, K_CTE_ENABLE, "0", m_sIniFile)
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Checked
|
|
|
|
#Region "Tolerance"
|
|
|
|
Private Property m_sToleranceTxBx As String
|
|
Public Property sToleranceTxBx As String
|
|
Get
|
|
Return m_sToleranceTxBx
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sToleranceTxBx Then
|
|
m_sToleranceTxBx = value
|
|
Dim i As Integer = 0
|
|
Try
|
|
i = Integer.Parse(m_sToleranceTxBx, Globalization.NumberStyles.Any)
|
|
If i < 0 Then
|
|
m_sToleranceTxBx = "0"
|
|
ElseIf i > 50 Then
|
|
m_sToleranceTxBx = "50"
|
|
End If
|
|
Catch ex As Exception
|
|
m_sToleranceTxBx = ""
|
|
End Try
|
|
WritePrivateProfileString(S_COLORTOSIDEANG,
|
|
K_CTSA_TOLERANCE,
|
|
If(String.IsNullOrWhiteSpace(m_sToleranceTxBx) OrElse m_sToleranceTxBx.Equals("-"), "0", m_sToleranceTxBx),
|
|
m_sIniFile)
|
|
NotifyPropertyChanged("sToleranceTxBx")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private Property m_sToleranceETxBx As String
|
|
Public Property sToleranceETxBx As String
|
|
Get
|
|
Return m_sToleranceETxBx
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sToleranceETxBx Then
|
|
m_sToleranceETxBx = value
|
|
Dim i As Integer = 0
|
|
Try
|
|
i = Integer.Parse(m_sToleranceETxBx, Globalization.NumberStyles.Any)
|
|
If i < 0 Then
|
|
m_sToleranceETxBx = "0"
|
|
ElseIf i > 50 Then
|
|
m_sToleranceETxBx = "50"
|
|
End If
|
|
Catch ex As Exception
|
|
m_sToleranceETxBx = ""
|
|
End Try
|
|
WritePrivateProfileString(S_COLORTOENGRAVE,
|
|
K_CTE_TOLERANCE,
|
|
If(String.IsNullOrWhiteSpace(m_sToleranceETxBx) OrElse m_sToleranceETxBx.Equals("-"), "0", m_sToleranceETxBx),
|
|
m_sIniFile)
|
|
NotifyPropertyChanged("sToleranceETxBx")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Tolerance
|
|
|
|
#End Region ' COMMANDS"
|
|
|
|
'------------------------------------SideAngle----------------------------------------
|
|
Public Class ColorLsBxItem
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private Property m_nCTSAIndex As Integer
|
|
Public Property nCTSAIndex As Integer
|
|
Get
|
|
Return m_nCTSAIndex
|
|
End Get
|
|
Set(value As Integer)
|
|
If value <> m_nCTSAIndex Then
|
|
m_nCTSAIndex = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private Property m_CTSAiChecked As Boolean
|
|
Public Property CTSAiChecked As Boolean
|
|
Get
|
|
Return m_CTSAiChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_CTSAiChecked Then
|
|
m_CTSAiChecked = value
|
|
CTSAiWriteString()
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private Property m_CTSAiBackground As Color3d
|
|
Public ReadOnly Property CTSAiBackground As Brush
|
|
Get
|
|
Dim x = New SolidColorBrush( Color.FromArgb( CByte( m_CTSAiBackground.A / 100 * 255),
|
|
CByte( m_CTSAiBackground.R),
|
|
CByte( m_CTSAiBackground.G),
|
|
CByte( m_CTSAiBackground.B)))
|
|
Return x
|
|
End Get
|
|
End Property
|
|
|
|
Private Property m_sCTSAiInclinazioneText As String
|
|
Public Property sCTSAiInclinazioneText As String
|
|
Get
|
|
Return m_sCTSAiInclinazioneText
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sCTSAiInclinazioneText Then
|
|
Dim dVal As Double
|
|
If StringToDouble( value, dVal) Then
|
|
m_sCTSAiInclinazioneText = value
|
|
CTSAiWriteString()
|
|
else
|
|
m_sCTSAiInclinazioneText = ""
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private Property m_sCTSAiTalloneText As String
|
|
Public Property sCTSAiTalloneText As String
|
|
Get
|
|
Return m_sCTSAiTalloneText
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sCTSAiTalloneText Then
|
|
Dim dVal As Double
|
|
If StringToLen( value, dVal) Then
|
|
m_sCTSAiTalloneText = value
|
|
CTSAiWriteString()
|
|
else
|
|
m_sCTSAiTalloneText = ""
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdChangeCTSAiColor As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(Index As Integer, IsActive As Boolean, Color As Color3d, Inclinazione As Double, Tallone As Double)
|
|
Me.m_nCTSAIndex = Index
|
|
Me.m_CTSAiChecked = IsActive
|
|
Me.m_CTSAiBackground = Color
|
|
Me.m_sCTSAiInclinazioneText = DoubleToString( Inclinazione, 3)
|
|
Me.m_sCTSAiTalloneText = LenToString( Tallone, 3)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "ChangeCTSAiColorCommand"
|
|
|
|
Public ReadOnly Property ChangeCTSAiColorCommand As ICommand
|
|
Get
|
|
If m_cmdChangeCTSAiColor Is Nothing Then
|
|
m_cmdChangeCTSAiColor = New Command(AddressOf ChangeCTSAiColor)
|
|
End If
|
|
Return m_cmdChangeCTSAiColor
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub ChangeCTSAiColor(ByVal param As Object)
|
|
' Creo dialogo colori
|
|
Dim ColorDlg As New System.Windows.Forms.ColorDialog
|
|
ColorDlg.FullOpen = True
|
|
ColorDlg.Color = m_CTSAiBackground.ToColor()
|
|
' Visualizzo dialogo
|
|
If ColorDlg.ShowDialog() <> DialogResult.OK Then Return
|
|
' Se ok, aggiorno
|
|
Dim NewCol As New Color3d(192, 192, 192, 100)
|
|
NewCol.FromColor(ColorDlg.Color)
|
|
' Imposto il colore scelto sul pulsante
|
|
m_CTSAiBackground = NewCol
|
|
CTSAiWriteString()
|
|
NotifyPropertyChanged("CTSAiBackground")
|
|
End Sub
|
|
|
|
#End Region ' ChangeCTSAiColorCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
#Region "METHODS"
|
|
|
|
Private Sub CTSAiWriteString()
|
|
' Sistemo i parametri double
|
|
Dim dSlant As Double = 0 : StringToDouble( sCTSAiInclinazioneText, dSlant)
|
|
Dim sSlant As String = DoubleToString( dSlant, 3)
|
|
Dim dHeel As Double = 0 : StringToLen( sCTSAiTalloneText, dHeel)
|
|
Dim sHeel As String = DoubleToString( dHeel, 3)
|
|
' Costruisco la stringa da mettere nell'INI
|
|
Dim sData As String = m_CTSAiBackground.R.ToString() & "," &
|
|
m_CTSAiBackground.G.ToString() & "," &
|
|
m_CTSAiBackground.B.ToString() & "," &
|
|
sSlant & "," &
|
|
sHeel & "," &
|
|
If( CTSAiChecked, "1", "0")
|
|
WritePrivateProfileString( S_COLORTOSIDEANG, K_CTSA & nCTSAIndex.ToString(), sData, m_sIniFile)
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
End Class
|
|
|
|
'-------------------------------------Engrave-----------------------------------------
|
|
Public Class ColorLsEngraveBxItem
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private Property m_nCTEIndex As Integer
|
|
Public Property nCTEIndex As Integer
|
|
Get
|
|
Return m_nCTEIndex
|
|
End Get
|
|
Set(value As Integer)
|
|
If value <> m_nCTEIndex Then
|
|
m_nCTEIndex = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private Property m_CTEiChecked As Boolean
|
|
Public Property CTEiChecked As Boolean
|
|
Get
|
|
Return m_CTEiChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_CTEiChecked Then
|
|
m_CTEiChecked = value
|
|
CTEiWriteString()
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private Property m_CTEiBackground As Color3d
|
|
Public ReadOnly Property CTEiBackground As Brush
|
|
Get
|
|
Dim x = New SolidColorBrush(Color.FromArgb(CByte(m_CTEiBackground.A / 100 * 255),
|
|
CByte(m_CTEiBackground.R),
|
|
CByte(m_CTEiBackground.G),
|
|
CByte(m_CTEiBackground.B)))
|
|
Return x
|
|
End Get
|
|
End Property
|
|
|
|
Private Property m_sCTEiAffondamentoText As String
|
|
Public Property sCTEiAffondamentoText As String
|
|
Get
|
|
Return m_sCTEiAffondamentoText
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sCTEiAffondamentoText Then
|
|
Dim dVal As Double
|
|
If StringToDouble(value, dVal) Then
|
|
m_sCTEiAffondamentoText = value
|
|
CTEiWriteString()
|
|
Else
|
|
m_sCTEiAffondamentoText = ""
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private Property m_sCTEiLarghezzaText As String
|
|
Public Property sCTEiLarghezzaText As String
|
|
Get
|
|
Return m_sCTEiLarghezzaText
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sCTEiLarghezzaText Then
|
|
Dim dVal As Double
|
|
If StringToLen(value, dVal) Then
|
|
m_sCTEiLarghezzaText = value
|
|
CTEiWriteString()
|
|
Else
|
|
m_sCTEiLarghezzaText = ""
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdChangeCTEiColor As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(Index As Integer, IsActive As Boolean, Color As Color3d, Affondamento As Double, Larghezza As Double)
|
|
Me.m_nCTEIndex = Index
|
|
Me.m_CTEiChecked = IsActive
|
|
Me.m_CTEiBackground = Color
|
|
Me.m_sCTEiAffondamentoText = DoubleToString(Affondamento, 3)
|
|
Me.m_sCTEiLarghezzaText = LenToString(Larghezza, 3)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "ChangeCTSAiColorCommand"
|
|
|
|
Public ReadOnly Property ChangeCTEiColorCommand As ICommand
|
|
Get
|
|
If m_cmdChangeCTEiColor Is Nothing Then
|
|
m_cmdChangeCTEiColor = New Command(AddressOf ChangeCTEiColor)
|
|
End If
|
|
Return m_cmdChangeCTEiColor
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub ChangeCTEiColor(ByVal param As Object)
|
|
' Creo dialogo colori
|
|
Dim ColorDlg As New System.Windows.Forms.ColorDialog
|
|
ColorDlg.FullOpen = True
|
|
ColorDlg.Color = m_CTEiBackground.ToColor()
|
|
' Visualizzo dialogo
|
|
If ColorDlg.ShowDialog() <> DialogResult.OK Then Return
|
|
' Se ok, aggiorno
|
|
Dim NewCol As New Color3d(192, 192, 192, 100)
|
|
NewCol.FromColor(ColorDlg.Color)
|
|
' Imposto il colore scelto sul pulsante
|
|
m_CTEiBackground = NewCol
|
|
CTEiWriteString()
|
|
NotifyPropertyChanged("CTEiBackground")
|
|
End Sub
|
|
|
|
#End Region ' ChangeCTSAiColorCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
#Region "METHODS"
|
|
|
|
Private Sub CTEiWriteString()
|
|
' Sistemo i parametri double
|
|
Dim dAff As Double = 0 : StringToDouble(sCTEiAffondamentoText, dAff)
|
|
Dim sAff As String = DoubleToString(dAff, 3)
|
|
Dim dLar As Double = 0 : StringToLen(sCTEiLarghezzaText, dLar)
|
|
Dim sLar As String = DoubleToString(dLar, 3)
|
|
' Costruisco la stringa da mettere nell'INI
|
|
Dim sData As String = m_CTEiBackground.R.ToString() & "," &
|
|
m_CTEiBackground.G.ToString() & "," &
|
|
m_CTEiBackground.B.ToString() & "," &
|
|
sAff & "," &
|
|
sLar & "," &
|
|
If(CTEiChecked, "1", "0")
|
|
WritePrivateProfileString(S_COLORTOENGRAVE, K_CTE & nCTEIndex.ToString(), sData, m_sIniFile)
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
End Class
|
|
|
|
End Class
|