PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/Source Code/PowerSong/Item Management/frmNotice.vb

#
Visual Basic | 91 lines | 62 code | 27 blank | 2 comment | 1 complexity | e9e544f7d8544036b1aed2752cef06c7 MD5 | raw file
  1. Imports System.Windows.Forms
  2. Imports PowerSong.Projection
  3. Imports PowerSong.SongDatabase
  4. Public Class frmNotice
  5. Private FNotice As Notice = Nothing
  6. Public ReadOnly Property Notice() As Notice
  7. Get
  8. UpdateNotice()
  9. Return FNotice
  10. End Get
  11. End Property
  12. Private FDatabase As Database = Nothing
  13. Public Sub New(ByVal database As Database)
  14. InitializeComponent()
  15. FDatabase = database
  16. pbTextColour.BackColor = database.Settings.NoticeDefaultBackgroundColour
  17. pbBackgroundColour.BackColor = database.Settings.NoticeDefaultFontColour
  18. txtDuration.Value = database.Settings.NoticeDefaultDuration
  19. End Sub
  20. Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
  21. ' Validate the form
  22. If txtContent.Text.Trim.Length = 0 Then
  23. MsgBox("Please specify some content for the notice.", MsgBoxStyle.Information)
  24. Exit Sub
  25. End If
  26. ' Close the form
  27. Me.DialogResult = System.Windows.Forms.DialogResult.OK
  28. Me.Close()
  29. End Sub
  30. Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
  31. Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
  32. Me.Close()
  33. End Sub
  34. Private Sub SelectTextColour(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectTextColour.Click, pbTextColour.Click
  35. dlgSelectColour.Color = pbTextColour.BackColor
  36. If dlgSelectColour.ShowDialog = Windows.Forms.DialogResult.OK Then
  37. pbTextColour.BackColor = dlgSelectColour.Color
  38. End If
  39. End Sub
  40. Private Sub SelectBackgroundColour(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectBackgroundColour.Click, pbBackgroundColour.Click
  41. dlgSelectColour.Color = pbBackgroundColour.BackColor
  42. If dlgSelectColour.ShowDialog = Windows.Forms.DialogResult.OK Then
  43. pbBackgroundColour.BackColor = dlgSelectColour.Color
  44. End If
  45. End Sub
  46. Private Sub UpdateNotice()
  47. Dim BackgroundColour As Color = FDatabase.Settings.NoticeDefaultBackgroundColour
  48. Dim ForegroundColour As Color = FDatabase.Settings.NoticeDefaultFontColour
  49. Dim Duration As Integer = FDatabase.Settings.NoticeDefaultDuration
  50. If chkOverrideSettings.Checked Then
  51. BackgroundColour = pbBackgroundColour.BackColor
  52. ForegroundColour = pbTextColour.BackColor
  53. Duration = txtDuration.Value
  54. End If
  55. FNotice = New Notice(txtContent.Text, FDatabase.Settings.NoticeSpeed, Duration, BackgroundColour, ForegroundColour)
  56. FNotice.Font = New Font(FDatabase.Settings.NoticeFontName, _
  57. FDatabase.Settings.NoticeFontSize, _
  58. FDatabase.Settings.NoticeFontStyle, _
  59. GraphicsUnit.Point)
  60. End Sub
  61. Private Sub chkOverrideSettings_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkOverrideSettings.CheckedChanged
  62. pnlOverride.Enabled = chkOverrideSettings.Checked
  63. End Sub
  64. End Class