Files
EgtDOORCreator/OptionsWindow/OptionsViewModel.vb
T
Nicola Pievani f365dee1c7 EgtDOORCreator 1.8d1 :
- Asterisco in fase di modifica;
- salvataggio in caso di cambio porta solo se presente asterisco;
- asterisco in fase di creazione nuova porta.
2017-04-06 18:17:33 +00:00

416 lines
12 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtUILib
Public Class OptionsViewModel
Public ReadOnly Property LanguageList As ObservableCollection(Of Language)
Get
Return OptionModule.m_LanguageList
End Get
End Property
Public Property SelectedLanguage As Language
Get
Return OptionModule.m_SelectedLanguage
End Get
Set(value As Language)
If value IsNot OptionModule.m_SelectedLanguage Then
OptionModule.m_SelectedLanguage = value
WritePrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name)
End If
End Set
End Property
Public ReadOnly Property MeasureUnitList As List(Of String)
Get
Return OptionModule.m_MeasureUnitList
End Get
End Property
Public Property SelectedMeasureUnit As String
Get
Return OptionModule.m_SelectedMeasureUnit
End Get
Set(value As String)
If value IsNot OptionModule.m_SelectedMeasureUnit Then
OptionModule.m_SelectedMeasureUnit = value
' iniziliazzo il valore dell'unità di misura
DdfFile.UnitMeasure = value
If value = OptionModule.m_MeasureUnitList(0) Then
OptionModule.m_bIsMmUnit = True
ElseIf value = OptionModule.m_MeasureUnitList(1) Then
OptionModule.m_bIsMmUnit = False
End If
EgtSetUiUnits(OptionModule.m_bIsMmUnit)
WritePrivateProfileString(S_SCENE, K_MMUNITS, If(OptionModule.m_bIsMmUnit, 1, 0).ToString)
End If
End Set
End Property
Public ReadOnly Property OptionLauncher As List(Of String)
Get
Return OptionModule.m_OptionLauncherList
End Get
End Property
Public Property SelectedOptionLauncher As String
Get
Return OptionModule.m_SelectedOptionLauncher
End Get
Set(value As String)
If value IsNot OptionModule.m_SelectedOptionLauncher Then
OptionModule.m_SelectedOptionLauncher = Trim(value)
Select Case OptionModule.m_SelectedOptionLauncher
Case "Open Window"
WritePrivateProfileString(S_LAUNCHERWINDOW, K_LAUNCHER, CStr(0))
Case "Last Project"
WritePrivateProfileString(S_LAUNCHERWINDOW, K_LAUNCHER, CStr(1))
Case "Empty"
WritePrivateProfileString(S_LAUNCHERWINDOW, K_LAUNCHER, CStr(2))
End Select
End If
End Set
End Property
' Carico i valori di Default della porta
Public Property WidthValue As String
Get
Return OptionModule.m_Width
End Get
Set(value As String)
OptionModule.m_Width = value
DefaultWritePrivateProfileString(S_SIZE, K_WIDTH_INI, OptionModule.m_Width)
End Set
End Property
Public Property HeightValue As String
Get
Return OptionModule.m_Height
End Get
Set(value As String)
OptionModule.m_Height = value
DefaultWritePrivateProfileString(S_SIZE, K_HEIGHT_INI, OptionModule.m_Height)
End Set
End Property
Public Property ThicknessValue As String
Get
Return OptionModule.m_Thickness
End Get
Set(value As String)
OptionModule.m_Thickness = value
DefaultWritePrivateProfileString(S_SIZE, K_THICKNESS_INI, OptionModule.m_Thickness)
End Set
End Property
Public ReadOnly Property SwingTypeList As List(Of String)
Get
Return OptionModule.m_SwingTypeList
End Get
End Property
Public Property SwingValue As String
Get
Return OptionModule.m_Swing
End Get
Set(value As String)
OptionModule.m_Swing = value
DefaultWritePrivateProfileString(S_SIZE, K_SWING_INI, OptionModule.m_Swing)
End Set
End Property
Public ReadOnly Property EdgeTypeList As List(Of String)
Get
Return OptionModule.m_EdgeTypeList
End Get
End Property
Public Property LockEdgeType As String
Get
Return OptionModule.m_LockEdgeType
End Get
Set(value As String)
OptionModule.m_LockEdgeType = value
DefaultWritePrivateProfileString(S_EDGE, K_LOCKEDGE_INI, OptionModule.m_LockEdgeType)
End Set
End Property
Public Property HingeEdgeType As String
Get
Return OptionModule.m_HingeEdgeType
End Get
Set(value As String)
OptionModule.m_HingeEdgeType = value
DefaultWritePrivateProfileString(S_EDGE, K_HINGEDGE_INI, OptionModule.m_HingeEdgeType)
End Set
End Property
Public Property TopType As String
Get
Return OptionModule.m_TopType
End Get
Set(value As String)
OptionModule.m_TopType = value
DefaultWritePrivateProfileString(S_EDGE, K_TOPEDGE_INI, OptionModule.m_TopType)
End Set
End Property
Public Property BottomType As String
Get
Return OptionModule.m_BottomType
End Get
Set(value As String)
OptionModule.m_BottomType = value
DefaultWritePrivateProfileString(S_EDGE, K_BOTTOMEDGE_INI, OptionModule.m_BottomType)
End Set
End Property
' is Checked
Public Property LockEdgeIsChecked As Boolean
Get
Return OptionModule.m_LockEdgeMachining
End Get
Set(value As Boolean)
OptionModule.m_LockEdgeMachining = value
If value Then
DefaultWritePrivateProfileString(S_MACHINING, K_LOCKEDGEISCHECKED_INI, "1")
Else
DefaultWritePrivateProfileString(S_MACHINING, K_LOCKEDGEISCHECKED_INI, "0")
End If
End Set
End Property
Public Property HingeEdgeIsChecked As Boolean
Get
Return OptionModule.m_HingeEdgeMachining
End Get
Set(value As Boolean)
OptionModule.m_HingeEdgeMachining = value
If value Then
DefaultWritePrivateProfileString(S_MACHINING, K_HINGEDGEEISCHECKED_INI, "1")
Else
DefaultWritePrivateProfileString(S_MACHINING, K_HINGEDGEEISCHECKED_INI, "0")
End If
End Set
End Property
Public Property TopIsChecked As Boolean
Get
Return OptionModule.m_TopMachining
End Get
Set(value As Boolean)
OptionModule.m_TopMachining = value
If value Then
DefaultWritePrivateProfileString(S_MACHINING, K_TOPISCHECKED_INI, "1")
Else
DefaultWritePrivateProfileString(S_MACHINING, K_TOPISCHECKED_INI, "0")
End If
End Set
End Property
Public Property BottomIsChecked As Boolean
Get
Return OptionModule.m_BottomMachining
End Get
Set(value As Boolean)
OptionModule.m_BottomMachining = value
If value Then
DefaultWritePrivateProfileString(S_MACHINING, K_BOTTOMISCHECKED_INI, "1")
Else
DefaultWritePrivateProfileString(S_MACHINING, K_BOTTOMISCHECKED_INI, "0")
End If
End Set
End Property
' OverMaterial
Public Property LockEdgeOverMaterialValue As String
Get
Return OptionModule.m_LockEdgeOverMaterial
End Get
Set(value As String)
OptionModule.m_LockEdgeOverMaterial = value
DefaultWritePrivateProfileString(S_OVERMATERIAL, K_LOCKEDGEOVERMATERIAL_INI, OptionModule.m_LockEdgeOverMaterial)
End Set
End Property
Public Property HingeEdgeOverMaterialValue As String
Get
Return OptionModule.m_HingeEdgeOverMaterial
End Get
Set(value As String)
OptionModule.m_HingeEdgeOverMaterial = value
DefaultWritePrivateProfileString(S_OVERMATERIAL, K_HINGEDGEOVERMATERIAL_INI, OptionModule.m_HingeEdgeOverMaterial)
End Set
End Property
Public Property TopOverMaterialValue As String
Get
Return OptionModule.m_TopOverMaterial
End Get
Set(value As String)
OptionModule.m_TopOverMaterial = value
DefaultWritePrivateProfileString(S_OVERMATERIAL, K_TOPOVERMATERIAL_INI, OptionModule.m_TopOverMaterial)
End Set
End Property
Public Property BottomOverMaterialValue As String
Get
Return OptionModule.m_BottomOverMaterial
End Get
Set(value As String)
OptionModule.m_BottomOverMaterial = value
DefaultWritePrivateProfileString(S_OVERMATERIAL, K_BOTTOMOVERMATERIAL_INI, OptionModule.m_BottomOverMaterial)
End Set
End Property
' Definizione comandi
Private m_cmdCloseOptions As ICommand
#Region "Messages"
Public ReadOnly Property Title As String
Get
Return EgtMsg(MSG_MAINWINDOW + 209)
End Get
End Property
Public ReadOnly Property StartUpMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 210)
End Get
End Property
Public ReadOnly Property CurrentLanguageMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 1)
End Get
End Property
Public ReadOnly Property LanguageAdvertMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 2)
End Get
End Property
Public ReadOnly Property MeasureUnit As String
Get
Return EgtMsg(MSG_MAINWINDOW + 200)
End Get
End Property
Public ReadOnly Property General As String
Get
Return EgtMsg(MSG_MAINWINDOW + 201)
End Get
End Property
Public ReadOnly Property WidthMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 1)
End Get
End Property
Public ReadOnly Property HeightMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 2)
End Get
End Property
Public ReadOnly Property ThicknessMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 3)
End Get
End Property
Public ReadOnly Property SwingMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 4)
End Get
End Property
Public ReadOnly Property LockEdgeMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 5)
End Get
End Property
Public ReadOnly Property HingeEdgeMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 6)
End Get
End Property
Public ReadOnly Property TopMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 7)
End Get
End Property
Public ReadOnly Property BottomMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 8)
End Get
End Property
' Machinig
Public ReadOnly Property LockEdgeOverMaterial As String
Get
Return EgtMsg(MSG_MAINWINDOW + 202)
End Get
End Property
Public ReadOnly Property HingeEdgeOverMaterial As String
Get
Return EgtMsg(MSG_MAINWINDOW + 203)
End Get
End Property
Public ReadOnly Property TopOverMaterial As String
Get
Return EgtMsg(MSG_MAINWINDOW + 204)
End Get
End Property
Public ReadOnly Property BottomOverMaterial As String
Get
Return EgtMsg(MSG_MAINWINDOW + 205)
End Get
End Property
#End Region
#Region "COMMANDS"
#Region "CloseOptionsCommand"
''' <summary>
''' Returns a command that remove the current selected machining.
''' </summary>
Public ReadOnly Property CloseOptionsCommand() As ICommand
Get
If m_cmdCloseOptions Is Nothing Then
m_cmdCloseOptions = New Command(AddressOf CloseOptions)
End If
Return m_cmdCloseOptions
End Get
End Property
''' <summary>
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
''' </summary>
Public Sub CloseOptions()
' Chiusura finestra
For Each Window In Application.Current.Windows
If TypeOf Window Is OptionsView Then
Dim OptionsWindow As OptionsView = DirectCast(Window, OptionsView)
OptionsWindow.Close()
End If
Next
End Sub
#End Region ' CloseOptionsCommand
#End Region ' COMMANDS
End Class