8ee0f3bda1
- Modifiche varie.
290 lines
10 KiB
VB.net
290 lines
10 KiB
VB.net
Imports EgtUILib
|
|
|
|
Namespace EgtCAM5
|
|
|
|
Public Class StatusBarViewModel
|
|
Inherits ViewModelBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
' GRAPHICAL ELEMENTS
|
|
Private m_StatusOutput As String
|
|
Public Property StatusOutput As String
|
|
Get
|
|
Return m_StatusOutput
|
|
End Get
|
|
Set(value As String)
|
|
m_StatusOutput = value
|
|
OnPropertyChanged("StatusOutput")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_StatusCurrPos As String
|
|
Public Property StatusCurrPos As String
|
|
Get
|
|
Return m_StatusCurrPos
|
|
End Get
|
|
Set(value As String)
|
|
m_StatusCurrPos = value
|
|
OnPropertyChanged("StatusCurrPos")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_StatusProgress As Integer
|
|
Public Property StatusProgress As Integer
|
|
Get
|
|
Return m_StatusProgress
|
|
End Get
|
|
Set(value As Integer)
|
|
m_StatusProgress = value
|
|
OnPropertyChanged("StatusProgress")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_StatusStopIsEnabled As Boolean
|
|
Public Property StatusStopIsEnabled As Boolean
|
|
Get
|
|
Return m_StatusStopIsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_StatusStopIsEnabled = value
|
|
OnPropertyChanged("StatusStopIsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_StatusGridText As String
|
|
Public Property StatusGridText As String
|
|
Get
|
|
Return m_StatusGridText
|
|
End Get
|
|
Set(value As String)
|
|
m_StatusGridText = value
|
|
OnPropertyChanged("StatusGridText")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_CurrPosTypeText As String
|
|
Public Property CurrPosTypeText As String
|
|
Get
|
|
Return m_CurrPosTypeText
|
|
End Get
|
|
Set(value As String)
|
|
m_CurrPosTypeText = value
|
|
OnPropertyChanged("CurrPosTypeText")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_StatusUnitsText As String
|
|
Public Property StatusUnitsText As String
|
|
Get
|
|
Return m_StatusUnitsText
|
|
End Get
|
|
Set(value As String)
|
|
m_StatusUnitsText = value
|
|
OnPropertyChanged("StatusUnitsText")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SnapPointTypeText As String
|
|
Public Property SnapPointTypeText As String
|
|
Get
|
|
Return m_SnapPointTypeText
|
|
End Get
|
|
Set(value As String)
|
|
m_SnapPointTypeText = value
|
|
OnPropertyChanged("SnapPointTypeText")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SnapPointTypeBackground As SolidColorBrush
|
|
Public Property SnapPointTypeBackground As SolidColorBrush
|
|
Get
|
|
Return m_SnapPointTypeBackground
|
|
End Get
|
|
Set(value As SolidColorBrush)
|
|
m_SnapPointTypeBackground = value
|
|
OnPropertyChanged("SnapPointTypeBackground")
|
|
End Set
|
|
End Property
|
|
|
|
' Commands definition
|
|
Private m_cmdStatusGrid As ICommand
|
|
Private m_cmdCurrPosType As ICommand
|
|
Private m_cmdStatusUnits As ICommand
|
|
Private m_cmdStatusStop As ICommand
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
Application.Msn.Register(Application.NOTIFYCURRPOS, Sub(sCursorPos As String)
|
|
StatusCurrPos = sCursorPos
|
|
End Sub)
|
|
Application.Msn.Register(Application.NOTIFYSTATUSOUTPUT, Sub(sStatusOutput As String)
|
|
StatusOutput = sStatusOutput
|
|
End Sub)
|
|
Application.Msn.Register(Application.NOTIFYSTATUSPROGRESS, Sub(sStatusProgress As Integer)
|
|
StatusProgress = sStatusProgress
|
|
End Sub)
|
|
Application.Msn.Register(Application.NOTIFYSTATUSSTOP, Sub(sStatusStop As Boolean)
|
|
StatusStopIsEnabled = sStatusStop
|
|
End Sub)
|
|
Application.Msn.Register(Application.UPDATESTATUSGRID, Sub(UpdateStatusGridParam As UpdateStatusGridParam)
|
|
UpdateStatusGrid(UpdateStatusGridParam.m_bShowGrid, UpdateStatusGridParam.m_bShowGridFrame)
|
|
End Sub)
|
|
Application.Msn.Register(Application.STATUSCURRPOSTYPETEXT, Sub(sString As String)
|
|
CurrPosTypeText = sString
|
|
End Sub)
|
|
Application.Msn.Register(Application.UPDATESTATUSUNITS, Sub(bMmUnits As Boolean)
|
|
StatusUnitsText = If(bMmUnits, "mm", "in")
|
|
EgtSetUiUnits(bMmUnits)
|
|
End Sub)
|
|
Application.Msn.Register(Application.STATUSSNAPPOINTTYPETEXT, Sub(sString As String)
|
|
SnapPointTypeText = sString
|
|
End Sub)
|
|
Application.Msn.Register(Application.STATUSSNAPPOINTTYPEBACKGROUND, Sub(Color As SolidColorBrush)
|
|
SnapPointTypeBackground = Color
|
|
End Sub)
|
|
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "StatusGridCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that set grid status.
|
|
''' </summary>
|
|
Public ReadOnly Property StatusGridCommand As ICommand
|
|
Get
|
|
If m_cmdStatusGrid Is Nothing Then
|
|
m_cmdStatusGrid = New RelayCommand(AddressOf StatusGrid, AddressOf CanStatusGrid)
|
|
End If
|
|
Return m_cmdStatusGrid
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Notify the function to set the status. This method is invoked by the StatusGridCommand.
|
|
''' </summary>
|
|
Public Sub StatusGrid(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.STATUSGRIDCOMMAND)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanStatusGrid(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' DoneCommand
|
|
|
|
#Region "CurrPosTypeCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that choose the current reference.
|
|
''' </summary>
|
|
Public ReadOnly Property CurrPosTypeCommand As ICommand
|
|
Get
|
|
If m_cmdCurrPosType Is Nothing Then
|
|
m_cmdCurrPosType = New RelayCommand(AddressOf CurrPosType, AddressOf CanCurrPosType)
|
|
End If
|
|
Return m_cmdCurrPosType
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Point. This method is invoked by the CurrPosTypeCommand.
|
|
''' </summary>
|
|
Public Sub CurrPosType(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPECOMMAND)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanCurrPosType(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' CurrPosTypeCommand
|
|
|
|
#Region "StatusUnitsCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that choose the current reference.
|
|
''' </summary>
|
|
Public ReadOnly Property StatusUnitsCommand As ICommand
|
|
Get
|
|
If m_cmdStatusUnits Is Nothing Then
|
|
m_cmdStatusUnits = New RelayCommand(AddressOf StatusUnits, AddressOf CanStatusUnits)
|
|
End If
|
|
Return m_cmdStatusUnits
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Point. This method is invoked by the CurrPosTypeCommand.
|
|
''' </summary>
|
|
Public Sub StatusUnits(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.STATUSUNITSCOMMAND)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanStatusUnits(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' StatusUnitsCommand
|
|
|
|
#Region "StatusStopCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that choose the current reference.
|
|
''' </summary>
|
|
Public ReadOnly Property StatusStopCommand As ICommand
|
|
Get
|
|
If m_cmdStatusStop Is Nothing Then
|
|
m_cmdStatusStop = New RelayCommand(AddressOf StatusStop, AddressOf CanStatusStop)
|
|
End If
|
|
Return m_cmdStatusStop
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Point. This method is invoked by the CurrPosTypeCommand.
|
|
''' </summary>
|
|
Public Sub StatusStop(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.STATUSSTOPCOMMAND)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanStatusStop(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' StatusStopCommand
|
|
|
|
#End Region ' Commands
|
|
|
|
#Region "METHODS"
|
|
|
|
Private Sub UpdateStatusGrid(bShowGrid As Boolean, bShowGridFrame As Boolean)
|
|
'tsStatusGrid.ForeColor = If(m_bShowGrid, Color.Black, Color.Gray)
|
|
StatusGridText = If(bShowGrid, "GRID ON ", "GRID OFF")
|
|
EgtSetGridShow(bShowGrid, bShowGrid And bShowGridFrame)
|
|
End Sub
|
|
|
|
#End Region ' Methods
|
|
|
|
End Class
|
|
|
|
End Namespace |