Added column for tags and made form bigger. #177

This commit is contained in:
MikeMaximus
2019-03-16 21:24:21 -06:00
parent e507930994
commit b199b2a221
4 changed files with 61 additions and 33 deletions
+19 -18
View File
@@ -24,8 +24,8 @@ Partial Class frmChooseGame
Private Sub InitializeComponent() Private Sub InitializeComponent()
Me.lblChoose = New System.Windows.Forms.Label() Me.lblChoose = New System.Windows.Forms.Label()
Me.btnChoose = New System.Windows.Forms.Button() Me.btnChoose = New System.Windows.Forms.Button()
Me.lstGameBox = New System.Windows.Forms.ListBox()
Me.btnCancel = New System.Windows.Forms.Button() Me.btnCancel = New System.Windows.Forms.Button()
Me.lstGameBox = New System.Windows.Forms.ListView()
Me.SuspendLayout() Me.SuspendLayout()
' '
'lblChoose 'lblChoose
@@ -39,39 +39,40 @@ Partial Class frmChooseGame
' '
'btnChoose 'btnChoose
' '
Me.btnChoose.Location = New System.Drawing.Point(72, 135) Me.btnChoose.Location = New System.Drawing.Point(201, 176)
Me.btnChoose.Name = "btnChoose" Me.btnChoose.Name = "btnChoose"
Me.btnChoose.Size = New System.Drawing.Size(90, 23) Me.btnChoose.Size = New System.Drawing.Size(90, 23)
Me.btnChoose.TabIndex = 2 Me.btnChoose.TabIndex = 1
Me.btnChoose.Text = "C&hoose Game" Me.btnChoose.Text = "C&hoose Game"
Me.btnChoose.UseVisualStyleBackColor = True Me.btnChoose.UseVisualStyleBackColor = True
' '
'lstGameBox
'
Me.lstGameBox.FormattingEnabled = True
Me.lstGameBox.HorizontalScrollbar = True
Me.lstGameBox.Location = New System.Drawing.Point(15, 34)
Me.lstGameBox.Name = "lstGameBox"
Me.lstGameBox.Size = New System.Drawing.Size(228, 95)
Me.lstGameBox.Sorted = True
Me.lstGameBox.TabIndex = 1
'
'btnCancel 'btnCancel
' '
Me.btnCancel.Location = New System.Drawing.Point(168, 135) Me.btnCancel.Location = New System.Drawing.Point(297, 176)
Me.btnCancel.Name = "btnCancel" Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23) Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 3 Me.btnCancel.TabIndex = 2
Me.btnCancel.Text = "&Cancel" Me.btnCancel.Text = "&Cancel"
Me.btnCancel.UseVisualStyleBackColor = True Me.btnCancel.UseVisualStyleBackColor = True
' '
'lstGameBox
'
Me.lstGameBox.FullRowSelect = True
Me.lstGameBox.Location = New System.Drawing.Point(12, 25)
Me.lstGameBox.MultiSelect = False
Me.lstGameBox.Name = "lstGameBox"
Me.lstGameBox.Size = New System.Drawing.Size(360, 145)
Me.lstGameBox.TabIndex = 0
Me.lstGameBox.UseCompatibleStateImageBehavior = False
Me.lstGameBox.View = System.Windows.Forms.View.Details
'
'frmChooseGame 'frmChooseGame
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(255, 166) Me.ClientSize = New System.Drawing.Size(384, 211)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.lstGameBox) Me.Controls.Add(Me.lstGameBox)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnChoose) Me.Controls.Add(Me.btnChoose)
Me.Controls.Add(Me.lblChoose) Me.Controls.Add(Me.lblChoose)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
@@ -87,6 +88,6 @@ Partial Class frmChooseGame
End Sub End Sub
Friend WithEvents lblChoose As System.Windows.Forms.Label Friend WithEvents lblChoose As System.Windows.Forms.Label
Friend WithEvents btnChoose As System.Windows.Forms.Button Friend WithEvents btnChoose As System.Windows.Forms.Button
Friend WithEvents lstGameBox As System.Windows.Forms.ListBox
Friend WithEvents btnCancel As Button Friend WithEvents btnCancel As Button
Friend WithEvents lstGameBox As ListView
End Class End Class
+18 -15
View File
@@ -25,24 +25,25 @@ Public Class frmChooseGame
End Set End Set
End Property End Property
Private Sub FillComboBox() Private Sub FillList()
Dim sTags As String Dim sTags As String
Dim sName As String Dim oListViewItem As ListViewItem
lstGameBox.ValueMember = "Key"
lstGameBox.DisplayMember = "Value" lstGameBox.BeginUpdate()
lstGameBox.Columns.Add(frmChooseGame_ColumnName, 180)
lstGameBox.Columns.Add(frmChooseGame_ColumnTags, 175)
For Each o As clsGame In Process.DuplicateList For Each o As clsGame In Process.DuplicateList
sTags = mgrGameTags.PrintTagsbyID(o.ID) sTags = mgrGameTags.PrintTagsbyID(o.ID)
If sTags <> String.Empty Then oListViewItem = New ListViewItem(New String() {o.Name, sTags})
sName = o.Name & " (" & sTags & ")" oListViewItem.Tag = o.ID
Else If lstGameBox.Items.Count = 0 Then oListViewItem.Selected = True
sName = o.Name lstGameBox.Items.Add(oListViewItem)
End If
lstGameBox.Items.Add(New KeyValuePair(Of String, String)(o.ID, sName))
oGamesHash.Add(o.ID, o) oGamesHash.Add(o.ID, o)
Next Next
lstGameBox.SelectedIndex = 0 lstGameBox.EndUpdate()
End Sub End Sub
Private Sub SaveSelection() Private Sub SaveSelection()
@@ -51,8 +52,8 @@ Public Class frmChooseGame
End Sub End Sub
Private Sub GetSelection() Private Sub GetSelection()
Dim oSelected As KeyValuePair(Of String, String) = lstGameBox.SelectedItem Dim oSelected As String = lstGameBox.SelectedItems(0).Tag
oGame = DirectCast(oGamesHash.Item(oSelected.Key), clsGame) oGame = DirectCast(oGamesHash.Item(oSelected), clsGame)
SaveSelection() SaveSelection()
bGameSelected = True bGameSelected = True
Me.DialogResult = DialogResult.OK Me.DialogResult = DialogResult.OK
@@ -71,12 +72,14 @@ Public Class frmChooseGame
Private Sub frmChooseGame_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Private Sub frmChooseGame_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
SetForm() SetForm()
FillComboBox() FillList()
Me.Focus() Me.Focus()
End Sub End Sub
Private Sub btnChoose_Click(sender As System.Object, e As System.EventArgs) Handles btnChoose.Click Private Sub btnChoose_Click(sender As System.Object, e As System.EventArgs) Handles btnChoose.Click
GetSelection() If lstGameBox.SelectedItems.Count > 0 Then
GetSelection()
End If
End Sub End Sub
Private Sub frmChooseGame_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing Private Sub frmChooseGame_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
+18
View File
@@ -888,6 +888,24 @@ Namespace My.Resources
End Get End Get
End Property End Property
'''<summary>
''' Looks up a localized string similar to Name.
'''</summary>
Friend ReadOnly Property frmChooseGame_ColumnName() As String
Get
Return ResourceManager.GetString("frmChooseGame_ColumnName", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Tags.
'''</summary>
Friend ReadOnly Property frmChooseGame_ColumnTags() As String
Get
Return ResourceManager.GetString("frmChooseGame_ColumnTags", resourceCulture)
End Get
End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to Choose Game. ''' Looks up a localized string similar to Choose Game.
'''</summary> '''</summary>
+6
View File
@@ -2374,4 +2374,10 @@
<data name="mgrCommon_FolderSelection" xml:space="preserve"> <data name="mgrCommon_FolderSelection" xml:space="preserve">
<value>Current Folder</value> <value>Current Folder</value>
</data> </data>
<data name="frmChooseGame_ColumnName" xml:space="preserve">
<value>Name</value>
</data>
<data name="frmChooseGame_ColumnTags" xml:space="preserve">
<value>Tags</value>
</data>
</root> </root>