265 lines
7.7 KiB
VB.net
265 lines
7.7 KiB
VB.net
Imports EgtWPFLib5
|
|
Imports EgtUILib
|
|
|
|
Public Class GridPanelVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private m_StatusGridText As String = If(OptionModule.m_bGridState, GRID_ON, GRID_OFF)
|
|
Public ReadOnly Property StatusGridText As String
|
|
Get
|
|
Return m_StatusGridText
|
|
End Get
|
|
End Property
|
|
Friend Sub SetStatusGridText(value As String)
|
|
m_StatusGridText = value
|
|
NotifyPropertyChanged(NameOf(StatusGridText))
|
|
End Sub
|
|
|
|
Private m_GridDimensionText As String = If(OptionModule.m_bMmUnits, LenToString(OptionModule.m_dSnapStepMm, 4), LenToString(OptionModule.m_dSnapStepInch, 4))
|
|
Public Property GridDimensionText As String
|
|
Get
|
|
Return m_GridDimensionText
|
|
End Get
|
|
Set(value As String)
|
|
m_GridDimensionText = value
|
|
NotifyPropertyChanged(NameOf(GridDimensionText))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MeasureUnit As String = If(OptionModule.m_bMmUnits, MILLIMETER, INCH)
|
|
Public ReadOnly Property MeasureUnit As String
|
|
Get
|
|
Return m_MeasureUnit
|
|
End Get
|
|
End Property
|
|
Public Sub SetMeasureUnit(nMeasureUnit As Integer)
|
|
m_MeasureUnit = If(nMeasureUnit = 0, INCH, MILLIMETER)
|
|
NotifyPropertyChanged(NameOf(MeasureUnit))
|
|
End Sub
|
|
|
|
Private m_FileGridOnOffSVG As String = String.Empty
|
|
Public Property FileGridOnOffSVG As String
|
|
Get
|
|
Return m_FileGridOnOffSVG
|
|
End Get
|
|
Set(value As String)
|
|
m_FileGridOnOffSVG = value
|
|
NotifyPropertyChanged(NameOf(FileGridOnOffSVG))
|
|
End Set
|
|
End Property
|
|
Friend Sub SetFileGridOnOffSVG(sFileGridOnOffSVG As String)
|
|
m_FileGridOnOffSVG = sFileGridOnOffSVG
|
|
NotifyPropertyChanged(NameOf(FileGridOnOffSVG))
|
|
End Sub
|
|
|
|
Private m_FileGridDimSVG As String = String.Empty
|
|
Public Property FileGridDimSVG As String
|
|
Get
|
|
Return m_FileGridDimSVG
|
|
End Get
|
|
Set(value As String)
|
|
m_FileGridDimSVG = value
|
|
NotifyPropertyChanged(NameOf(FileGridDimSVG))
|
|
End Set
|
|
End Property
|
|
Friend Sub SetFileGridDimSVG(sFileGridDimSVG As String)
|
|
m_FileGridDimSVG = sFileGridDimSVG
|
|
NotifyPropertyChanged(NameOf(FileGridDimSVG))
|
|
End Sub
|
|
|
|
Private m_IsOpenGridDimension As Boolean = False
|
|
Public Property IsOpenGridDimension As Boolean
|
|
Get
|
|
Return m_IsOpenGridDimension
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsOpenGridDimension = value
|
|
End Set
|
|
End Property
|
|
Friend Sub SetIsOpenGridDimension(bIsOpenGridDimension As Boolean)
|
|
m_IsOpenGridDimension = bIsOpenGridDimension
|
|
NotifyPropertyChanged(NameOf(IsOpenGridDimension))
|
|
End Sub
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property MeasureUnit_Msg
|
|
Get
|
|
Return EgtMsg(110037) ' Unità di Misura
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
#Region "ToolTip"
|
|
|
|
Public ReadOnly Property ZoomAllToolTip As String
|
|
Get
|
|
Return EgtMsg(5254) ' Zoom All
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' ToolTip
|
|
|
|
' Definizione dei comandi
|
|
Private m_cmdStatusGrid As ICommand
|
|
Private m_cmdGridDimension As ICommand
|
|
Private m_cmdStatusUnits As ICommand
|
|
Private m_cmdZoomAll As ICommand
|
|
Private m_cmdShowPopUpCmd As ICommand
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONTRUCTOR"
|
|
|
|
Sub New()
|
|
Map.SetRefGridPanelVM(Me)
|
|
SetFileGridOnOffSVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\GridON.svg")
|
|
SetFileGridDimSVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\GridDIM.svg")
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Sub UpdateStatusGrid(bShowGrid As Boolean, bShowGridFrame As Boolean)
|
|
SetStatusGridText(If(bShowGrid, GRID_ON, GRID_OFF))
|
|
EgtSetGridShow(bShowGrid, bShowGrid And bShowGridFrame)
|
|
End Sub
|
|
|
|
Friend Sub UpdateStatusUnits(bMmUnits As Boolean)
|
|
SetMeasureUnit(If(bMmUnits, 1, 0)) 'StatusUnitsText = If(bMmUnits, "mm", "in")
|
|
EgtSetUiUnits(bMmUnits)
|
|
End Sub
|
|
|
|
Friend Sub UpdateMessageGridPanel()
|
|
NotifyPropertyChanged(NameOf(MeasureUnit_Msg))
|
|
End Sub
|
|
|
|
#End Region ' Methods
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "StatusGridCommand"
|
|
|
|
Public ReadOnly Property StatusGridCommand As ICommand
|
|
Get
|
|
If m_cmdStatusGrid Is Nothing Then
|
|
m_cmdStatusGrid = New Command(AddressOf StatusGrid)
|
|
End If
|
|
Return m_cmdStatusGrid
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub StatusGrid(ByVal param As Object)
|
|
Dim tmpGridState As Integer
|
|
OptionModule.m_bGridState = GetMainPrivateProfileInt(S_GENERAL, K_GRIDSTATE, 1)
|
|
If OptionModule.m_bGridState Then
|
|
tmpGridState = 0
|
|
Else
|
|
tmpGridState = 1
|
|
End If
|
|
UpdateStatusGrid(tmpGridState, OptionModule.m_bShowGridFrame)
|
|
WriteMainPrivateProfileString(S_GENERAL, K_GRIDSTATE, tmpGridState.ToString())
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
#End Region ' StatusGridCommand
|
|
|
|
#Region "GridDimensionCommand"
|
|
|
|
Public ReadOnly Property GridDimensionCommand As ICommand
|
|
Get
|
|
If m_cmdGridDimension Is Nothing Then
|
|
m_cmdGridDimension = New Command(AddressOf GridDimension)
|
|
End If
|
|
Return m_cmdGridDimension
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub GridDimension(ByVal param As Object)
|
|
If OptionModule.m_bMmUnits Then
|
|
StringToLen(m_GridDimensionText, OptionModule.m_dSnapStepMm)
|
|
EgtSetGridGeo(OptionModule.m_dSnapStepMm, OptionModule.m_nMinLineSStep, OptionModule.m_nMajLineSStep, OptionModule.m_nExtSStep)
|
|
Else
|
|
StringToLen(m_GridDimensionText, OptionModule.m_dSnapStepInch)
|
|
EgtSetGridGeo(OptionModule.m_dSnapStepInch, OptionModule.m_nMinLineSStep, OptionModule.m_nMajLineSStep, OptionModule.m_nExtSStep)
|
|
End If
|
|
EgtSetGridColor(OptionModule.m_MinLnColor, OptionModule.m_MajLnColor)
|
|
Keyboard.ClearFocus()
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
#End Region ' GridDimensionCommand
|
|
|
|
#Region "StatusUnitsCommand"
|
|
|
|
Public ReadOnly Property StatusUnitsCommand As ICommand
|
|
Get
|
|
If m_cmdStatusUnits Is Nothing Then
|
|
m_cmdStatusUnits = New Command(AddressOf StatusUnits)
|
|
End If
|
|
Return m_cmdStatusUnits
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub StatusUnits(ByVal param As Object)
|
|
Map.refSceneHostVM.StatusUnitsCommand()
|
|
If OptionModule.m_bMmUnits Then
|
|
m_GridDimensionText = LenToString(OptionModule.m_dSnapStepMm, 4)
|
|
Else
|
|
m_GridDimensionText = LenToString(OptionModule.m_dSnapStepInch, 4)
|
|
End If
|
|
WriteMainPrivateProfileString(S_SCENE, K_MMUNITS, If(OptionModule.m_bMmUnits, 1, 0).ToString())
|
|
End Sub
|
|
|
|
#End Region ' StatusUnitsCommand
|
|
|
|
#Region "ZoomAllCommand"
|
|
|
|
Public ReadOnly Property ZoomAllCommand As ICommand
|
|
Get
|
|
If m_cmdZoomAll Is Nothing Then
|
|
m_cmdZoomAll = New Command(AddressOf ZoomAll)
|
|
End If
|
|
Return m_cmdZoomAll
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the ZoomAll. This method is invoked by the ZoomAllCommand.
|
|
''' </summary>
|
|
Public Sub ZoomAll(ByVal param As Object)
|
|
Map.refSceneHostVM.MainScene.ZoomAll()
|
|
End Sub
|
|
|
|
#End Region ' ZoomAllCommand
|
|
|
|
#Region "ShowPopUpCommand"
|
|
|
|
Public ReadOnly Property ShowPopUpCommand As ICommand
|
|
Get
|
|
If m_cmdShowPopUpCmd Is Nothing Then
|
|
m_cmdShowPopUpCmd = New Command(AddressOf ShowPopUp)
|
|
End If
|
|
Return m_cmdShowPopUpCmd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub ShowPopUp(ByVal param As Object)
|
|
If m_IsOpenGridDimension Then
|
|
SetIsOpenGridDimension(False)
|
|
'SetView_Msg("▼" & EgtMsg(110019)) ' Vista
|
|
Else
|
|
SetIsOpenGridDimension(True)
|
|
'SetView_Msg("▲" & EgtMsg(110019)) ' Vista
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' ShowPopUpCommand
|
|
|
|
#End Region ' Commands
|
|
|
|
End Class |