Files
omagoffice/StatusBar/StatusBarVM.vb
T
Emmanuele Sassi 5278c1d2e0 OmagOffice :
- Aggiunta finestra disegno Compo.
- Migliorie varie.
2017-04-24 12:55:25 +00:00

129 lines
3.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 SolidColorBrush = Brushes.Black
Public Property MsgColor As SolidColorBrush
Get
Return m_MsgColor
End Get
Set(value As SolidColorBrush)
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
#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
#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