/Source Code/PowerSong/Custom Controls/NoticeLabel.vb
Visual Basic | 62 lines | 52 code | 10 blank | 0 comment | 0 complexity | 1217d39c8529afca4225dabbe25e3c06 MD5 | raw file
- Public Class NoticeLabel
-
- Public Property Message() As String
- Get
- Return lblMessage.Text
- End Get
- Set(ByVal value As String)
- lblMessage.Text = value
- lblMessage.Invalidate()
- End Set
- End Property
-
- Public Enum IconType
- [Error]
- Warning
- Info
- Running
- Passed
- Waiting
- End Enum
-
- Private FIcon As IconType = IconType.Info
-
- Public Property Icon() As IconType
- Get
- Return FIcon
- End Get
- Set(ByVal value As IconType)
- FIcon = value
- Select Case value
- Case IconType.Error : PictureBox1.Image = My.Resources._Error
- Case IconType.Info : PictureBox1.Image = My.Resources.Info
- Case IconType.Passed : PictureBox1.Image = My.Resources.Passed
- Case IconType.Running : PictureBox1.Image = My.Resources.Executing
- Case IconType.Warning : PictureBox1.Image = My.Resources.Warning
- Case IconType.Waiting : PictureBox1.Image = My.Resources.Waiting
- End Select
- End Set
- End Property
-
- Public Sub Change(ByVal newIcon As IconType, _
- ByVal message As String, _
- Optional ByVal showMessageBox As Boolean = False)
-
- Me.Icon = newIcon
- Me.Message = message
-
- If showMessageBox Then
- Dim Style As MsgBoxStyle = MsgBoxStyle.Information
- Select Case newIcon
- Case IconType.Error : Style = MsgBoxStyle.Critical
- Case IconType.Warning : Style = MsgBoxStyle.Exclamation
- End Select
- MsgBox(message, Style)
- End If
-
- Me.Update()
- Threading.Thread.Sleep(100)
-
- End Sub
-
- End Class