Files
EgtCAM5/OptionsWindow/OptionWindowVM.vb
T
Emmanuele Sassi a4b5cd4834 EgtCAM5 :
- Cambiati nomi classi e file.
2018-04-10 17:08:35 +00:00

195 lines
6.3 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class OptionWindowVM
Public ReadOnly Property LanguageList As ObservableCollection(Of Language)
Get
Return OptionModule.m_LanguageList
End Get
End Property
Private m_GeomTypeList As ObservableCollection(Of SceneSelModeOpt) = New ObservableCollection(Of SceneSelModeOpt)({SceneSelModeOpt.PARTCURVES, SceneSelModeOpt.PARTSURFACES, SceneSelModeOpt.PARTCURVESANDSURFACES})
Public ReadOnly Property GeomTypeList As ObservableCollection(Of SceneSelModeOpt)
Get
Return m_GeomTypeList
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 Property SelectedMillingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomMilling
End Get
Set(value As SceneSelModeOpt)
If WritePrivateProfileString(S_MACH, K_SELGEOMMILLING, CInt(value).ToString()) Then
OptionModule.m_SelGeomMilling = value
End If
End Set
End Property
Public Property SelectedDrillingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomDrilling
End Get
Set(value As SceneSelModeOpt)
If WritePrivateProfileString(S_MACH, K_SELGEOMDRILLING, CInt(value).ToString()) Then
OptionModule.m_SelGeomDrilling = value
End If
End Set
End Property
Public Property SelectedSawingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomSawing
End Get
Set(value As SceneSelModeOpt)
If WritePrivateProfileString(S_MACH, K_SELGEOMSAWING, CInt(value).ToString()) Then
OptionModule.m_SelGeomSawing = value
End If
End Set
End Property
Public Property NewMachiningIsLastOne As Boolean
Get
Return m_bNewMachiningIsLastOne
End Get
Set(value As Boolean)
m_bNewMachiningIsLastOne = value
WritePrivateProfileString(S_OPTIONS, K_NEWMACHININGISLASTONE, If(value, 1, 0).ToString)
End Set
End Property
Public Property UseDispositionScript As Boolean
Get
Return m_bUseDispositionScript
End Get
Set(value As Boolean)
m_bUseDispositionScript = value
WritePrivateProfileString(S_OPTIONS, K_USEDISPOSITIONSCRIPT, If(value, 1, 0).ToString)
End Set
End Property
' Definizione comandi
Private m_cmdCloseOptions As ICommand
#Region "Messages"
Public ReadOnly Property Title As String
Get
Return EgtMsg(MSG_MAINWINDOW + 5)
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 MachiningSelGeomMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 6)
End Get
End Property
Public ReadOnly Property GeomTypeMillingMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 3)
End Get
End Property
Public ReadOnly Property GeomTypeDrillingMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 1)
End Get
End Property
Public ReadOnly Property GeomTypeSawingMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 2)
End Get
End Property
Public ReadOnly Property NewMachiningPosMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 7)
End Get
End Property
Public ReadOnly Property UseDispositionScriptMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 8)
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 RelayCommand(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 OptionWindowV Then
Dim OptionsWindow As OptionWindowV = DirectCast(Window, OptionWindowV)
OptionsWindow.Close()
End If
Next
End Sub
#End Region ' CloseOptionsCommand
#End Region ' COMMANDS
End Class
End Namespace
Public Class GeomTypeConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Select Case CInt(value)
Case SceneSelModeOpt.PARTCURVES
Return EgtMsg(MSG_OPTIONPAGE + 3)
Case SceneSelModeOpt.PARTSURFACES
Return EgtMsg(MSG_OPTIONPAGE + 4)
Case Else
Return EgtMsg(MSG_OPTIONPAGE + 5)
End Select
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException
End Function
End Class