Initial population
This commit is contained in:
158
frmAddAlternateHymnTuneName.vb
Normal file
158
frmAddAlternateHymnTuneName.vb
Normal file
@@ -0,0 +1,158 @@
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Public Class frmAddAlternateHymnTuneName
|
||||
Inherits Windows.Forms.Form
|
||||
Private m_objCurrentHymnTuneName As clsHymnTuneName
|
||||
Private m_objAlternateHymnTuneNameChosen As clsHymnTuneName
|
||||
|
||||
#Region " Windows Form Designer generated code "
|
||||
|
||||
Protected Sub New()
|
||||
MyBase.New()
|
||||
|
||||
'This call is required by the Windows Form Designer.
|
||||
InitializeComponent()
|
||||
|
||||
'Add any initialization after the InitializeComponent() call
|
||||
|
||||
End Sub
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
If disposing Then
|
||||
If Not (components Is Nothing) Then
|
||||
components.Dispose()
|
||||
End If
|
||||
End If
|
||||
MyBase.Dispose(disposing)
|
||||
End Sub
|
||||
|
||||
'Required by the Windows Form Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Windows Form Designer
|
||||
'It can be modified using the Windows Form Designer.
|
||||
'Do not modify it using the code editor.
|
||||
Friend WithEvents lblAlternateHymnTuneName As Windows.Forms.Label
|
||||
Friend WithEvents lstAlternateHymnTuneNames As Windows.Forms.ListBox
|
||||
Friend WithEvents btnOK As Windows.Forms.Button
|
||||
Friend WithEvents btnCancel As Windows.Forms.Button
|
||||
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
||||
Me.lblAlternateHymnTuneName = New Windows.Forms.Label
|
||||
Me.lstAlternateHymnTuneNames = New Windows.Forms.ListBox
|
||||
Me.btnOK = New Windows.Forms.Button
|
||||
Me.btnCancel = New Windows.Forms.Button
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'lblAlternateHymnTuneName
|
||||
'
|
||||
Me.lblAlternateHymnTuneName.Location = New System.Drawing.Point(8, 8)
|
||||
Me.lblAlternateHymnTuneName.Name = "lblAlternateHymnTuneName"
|
||||
Me.lblAlternateHymnTuneName.Size = New System.Drawing.Size(448, 16)
|
||||
Me.lblAlternateHymnTuneName.TabIndex = 0
|
||||
'
|
||||
'lstAlternateHymnTuneNames
|
||||
'
|
||||
Me.lstAlternateHymnTuneNames.Location = New System.Drawing.Point(8, 24)
|
||||
Me.lstAlternateHymnTuneNames.Name = "lstAlternateHymnTuneNames"
|
||||
Me.lstAlternateHymnTuneNames.Size = New System.Drawing.Size(456, 433)
|
||||
Me.lstAlternateHymnTuneNames.Sorted = True
|
||||
Me.lstAlternateHymnTuneNames.TabIndex = 1
|
||||
'
|
||||
'btnOK
|
||||
'
|
||||
Me.btnOK.DialogResult = Windows.Forms.DialogResult.OK
|
||||
Me.btnOK.Location = New System.Drawing.Point(480, 8)
|
||||
Me.btnOK.Name = "btnOK"
|
||||
Me.btnOK.Size = New System.Drawing.Size(112, 24)
|
||||
Me.btnOK.TabIndex = 2
|
||||
Me.btnOK.Text = "&OK"
|
||||
'
|
||||
'btnCancel
|
||||
'
|
||||
Me.btnCancel.DialogResult = Windows.Forms.DialogResult.Cancel
|
||||
Me.btnCancel.Location = New System.Drawing.Point(480, 40)
|
||||
Me.btnCancel.Name = "btnCancel"
|
||||
Me.btnCancel.Size = New System.Drawing.Size(112, 24)
|
||||
Me.btnCancel.TabIndex = 3
|
||||
Me.btnCancel.Text = "&Cancel"
|
||||
'
|
||||
'frmAddAlternateHymnTuneName
|
||||
'
|
||||
Me.AcceptButton = Me.btnOK
|
||||
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
|
||||
Me.CancelButton = Me.btnCancel
|
||||
Me.ClientSize = New System.Drawing.Size(600, 462)
|
||||
Me.ControlBox = False
|
||||
Me.Controls.Add(Me.btnCancel)
|
||||
Me.Controls.Add(Me.btnOK)
|
||||
Me.Controls.Add(Me.lstAlternateHymnTuneNames)
|
||||
Me.Controls.Add(Me.lblAlternateHymnTuneName)
|
||||
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
|
||||
Me.MaximizeBox = False
|
||||
Me.MinimizeBox = False
|
||||
Me.Name = "frmAddAlternateHymnTuneName"
|
||||
Me.Text = "Add Alternate Hymn Tune Name"
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
Public Property CurrentHymnTuneName() As clsHymnTuneName
|
||||
Get
|
||||
Return m_objCurrentHymnTuneName
|
||||
End Get
|
||||
Set(ByVal Value As clsHymnTuneName)
|
||||
m_objCurrentHymnTuneName = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AlternateHymnTuneNameChosen() As clsHymnTuneName
|
||||
Get
|
||||
Return m_objAlternateHymnTuneNameChosen
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub LoadGUI(ByVal objCurrentHymnTuneName As clsHymnTuneName)
|
||||
CurrentHymnTuneName = objCurrentHymnTuneName
|
||||
|
||||
lblAlternateHymnTuneName.Text = "Select Alternate Hymn Tune Name for: " + objCurrentHymnTuneName.HymnTuneName
|
||||
Dim objHymnTuneNames As System.Collections.Generic.List(Of clsHymnTuneName) = clsHymnTuneName.GetAllHymnTuneNames()
|
||||
Dim objHymnTuneName As clsHymnTuneName
|
||||
For Each objHymnTuneName In objHymnTuneNames
|
||||
If objHymnTuneName.HymnTuneName = objCurrentHymnTuneName.HymnTuneName Then
|
||||
'Do not load this one - it is the one we are comparing to
|
||||
Else
|
||||
If objHymnTuneName.OtherHymnTuneNamesForTune.ContainsKey(objHymnTuneName.HymnTuneName) Then
|
||||
'Do not load this one - it already matches
|
||||
Else
|
||||
lstAlternateHymnTuneNames.Items.Add(objHymnTuneName)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
m_objAlternateHymnTuneNameChosen = Nothing
|
||||
End Sub
|
||||
|
||||
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
|
||||
If lstAlternateHymnTuneNames.SelectedItems.Count = 0 Then
|
||||
MessageBox.Show("Must select an alternate hymn tune name")
|
||||
Me.DialogResult = Windows.Forms.DialogResult.None
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
m_objAlternateHymnTuneNameChosen = CType(lstAlternateHymnTuneNames.SelectedItem, clsHymnTuneName)
|
||||
|
||||
'This button will close the form with Dialog Result OK
|
||||
End Sub
|
||||
|
||||
Public Shared Function GetAlternateHymnTuneNameChosen(ByVal objCurrentHymnTuneName As clsHymnTuneName) As clsHymnTuneName
|
||||
Dim objFrmAddAlternateHymnTuneName As New frmAddAlternateHymnTuneName
|
||||
objFrmAddAlternateHymnTuneName.LoadGUI(objCurrentHymnTuneName)
|
||||
objFrmAddAlternateHymnTuneName.ShowDialog()
|
||||
Dim lobjReturnValue As clsHymnTuneName = objFrmAddAlternateHymnTuneName.AlternateHymnTuneNameChosen
|
||||
objFrmAddAlternateHymnTuneName.Dispose()
|
||||
Return lobjReturnValue
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user