PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/Source Code/PowerSong/Custom Controls/NoticeLabel.vb

#
Visual Basic | 62 lines | 52 code | 10 blank | 0 comment | 0 complexity | 1217d39c8529afca4225dabbe25e3c06 MD5 | raw file
  1. Public Class NoticeLabel
  2. Public Property Message() As String
  3. Get
  4. Return lblMessage.Text
  5. End Get
  6. Set(ByVal value As String)
  7. lblMessage.Text = value
  8. lblMessage.Invalidate()
  9. End Set
  10. End Property
  11. Public Enum IconType
  12. [Error]
  13. Warning
  14. Info
  15. Running
  16. Passed
  17. Waiting
  18. End Enum
  19. Private FIcon As IconType = IconType.Info
  20. Public Property Icon() As IconType
  21. Get
  22. Return FIcon
  23. End Get
  24. Set(ByVal value As IconType)
  25. FIcon = value
  26. Select Case value
  27. Case IconType.Error : PictureBox1.Image = My.Resources._Error
  28. Case IconType.Info : PictureBox1.Image = My.Resources.Info
  29. Case IconType.Passed : PictureBox1.Image = My.Resources.Passed
  30. Case IconType.Running : PictureBox1.Image = My.Resources.Executing
  31. Case IconType.Warning : PictureBox1.Image = My.Resources.Warning
  32. Case IconType.Waiting : PictureBox1.Image = My.Resources.Waiting
  33. End Select
  34. End Set
  35. End Property
  36. Public Sub Change(ByVal newIcon As IconType, _
  37. ByVal message As String, _
  38. Optional ByVal showMessageBox As Boolean = False)
  39. Me.Icon = newIcon
  40. Me.Message = message
  41. If showMessageBox Then
  42. Dim Style As MsgBoxStyle = MsgBoxStyle.Information
  43. Select Case newIcon
  44. Case IconType.Error : Style = MsgBoxStyle.Critical
  45. Case IconType.Warning : Style = MsgBoxStyle.Exclamation
  46. End Select
  47. MsgBox(message, Style)
  48. End If
  49. Me.Update()
  50. Threading.Thread.Sleep(100)
  51. End Sub
  52. End Class