Files
omagoffice/StatusBar/StatusBarVM.vb
T
Dario Sassi 4d13949d51 OmagOFFICE :
- dopo misura reimposta stato selezione speciale
- corretti problemi con contesti di finiestre per componenti parametrici e DXF
- aggiunta indicazione tipo punto snap
- arricchite informazioni in AboutBox.
2017-06-17 17:34:14 +00:00

161 lines
4.5 KiB
VB.net

Imports EgtWPFLib5
Public Class StatusBarVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private WithEvents OutputMessageTimer As New System.Windows.Threading.DispatcherTimer
' GRAPHICAL ELEMENTS
Private m_OutputMessage As String
Public Property OutputMessage As String
Get
Return m_OutputMessage
End Get
Set(value As String)
m_OutputMessage = value
'NotifyPropertyChanged("OutputMessage")
End Set
End Property
Private m_MsgColor As Brush = Brushes.Black
Public Property MsgColor As Brush
Get
Return m_MsgColor
End Get
Set(value As Brush)
m_MsgColor = value
'NotifyPropertyChanged("MsgColor")
End Set
End Property
Private m_MeasureUnit As String
Public Property MeasureUnit As String
Get
Return m_MeasureUnit
End Get
Set(value As String)
m_MeasureUnit = value
'NotifyPropertyChanged("SelMeasureUnit")
End Set
End Property
Private m_CurrPos As String
Public Property CurrPos As String
Get
Return m_CurrPos
End Get
Set(value As String)
m_CurrPos = value
'NotifyPropertyChanged("StatusCurrPos")
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
'NotifyPropertyChanged("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
'NotifyPropertyChanged("SnapPointTypeBackground")
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in OmagOFFICEMap
OmagOFFICEMap.SetRefStatusBarVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Overloads Sub SetOutputMessage(sMessage As String, Optional nMsgType As MSG_TYPE = MSG_TYPE.INFO)
SetMsgColor(nMsgType)
m_OutputMessage = sMessage
NotifyPropertyChanged("OutputMessage")
End Sub
Friend Overloads Sub SetOutputMessage(sMessage As String, nTime As Integer, Optional nMsgType As MSG_TYPE = MSG_TYPE.INFO)
SetMsgColor(nMsgType)
m_OutputMessage = sMessage
NotifyPropertyChanged("OutputMessage")
OutputMessageTimer.Interval = TimeSpan.FromSeconds(nTime)
OutputMessageTimer.IsEnabled = True
OutputMessageTimer.Start()
End Sub
Friend Sub ClearOutputMessage()
m_MsgColor = Brushes.Black
NotifyPropertyChanged("MsgColor")
m_OutputMessage = String.Empty
NotifyPropertyChanged("OutputMessage")
If OutputMessageTimer.IsEnabled Then
OutputMessageTimer.Stop()
OutputMessageTimer.IsEnabled = False
End If
End Sub
Friend Sub SetMeasureUnit(nMeasureUnit As Integer)
m_MeasureUnit = If(nMeasureUnit = 0, "in", "mm")
NotifyPropertyChanged("MeasureUnit")
End Sub
Friend Overloads Sub SetCurrPos(sCurrPos As String)
m_CurrPos = sCurrPos
NotifyPropertyChanged("CurrPos")
End Sub
Private Sub SetMsgColor(nMsgType As MSG_TYPE)
Select Case nMsgType
Case MSG_TYPE.INFO
m_MsgColor = Brushes.Black
Case MSG_TYPE.WARNING
m_MsgColor = Brushes.SaddleBrown
Case MSG_TYPE.ERROR_
m_MsgColor = Brushes.Red
End Select
NotifyPropertyChanged("MsgColor")
End Sub
Friend Sub SetSnapPointTypeText(sSnapPntTypeText As String)
m_SnapPointTypeText = sSnapPntTypeText
NotifyPropertyChanged("SnapPointTypeText")
End Sub
Friend Sub SetSnapPointTypeBackground(SnapPntTypeBackground As SolidColorBrush)
m_SnapPointTypeBackground = SnapPntTypeBackground
NotifyPropertyChanged("SnapPointTypeBackground")
End Sub
#End Region ' METHODS
#Region "EVENTS"
Private Sub OutputMessageTimer_Tick(source As Object, e As EventArgs) Handles OutputMessageTimer.Tick
ClearOutputMessage()
OutputMessageTimer.Stop()
OutputMessageTimer.IsEnabled = False
End Sub
#End Region ' EVENTS
End Class