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()
Me.lblChoose = New System.Windows.Forms.Label()
Me.btnChoose = New System.Windows.Forms.Button()
Me.lstGameBox = New System.Windows.Forms.ListBox()
Me.btnCancel = New System.Windows.Forms.Button()
Me.lstGameBox = New System.Windows.Forms.ListView()
Me.SuspendLayout()
'
'lblChoose
@@ -39,39 +39,40 @@ Partial Class frmChooseGame
'
'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.Size = New System.Drawing.Size(90, 23)
Me.btnChoose.TabIndex = 2
Me.btnChoose.TabIndex = 1
Me.btnChoose.Text = "C&hoose Game"
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
'
Me.btnCancel.Location = New System.Drawing.Point(168, 135)
Me.btnCancel.Location = New System.Drawing.Point(297, 176)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 3
Me.btnCancel.TabIndex = 2
Me.btnCancel.Text = "&Cancel"
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
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(255, 166)
Me.Controls.Add(Me.btnCancel)
Me.ClientSize = New System.Drawing.Size(384, 211)
Me.Controls.Add(Me.lstGameBox)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnChoose)
Me.Controls.Add(Me.lblChoose)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
@@ -87,6 +88,6 @@ Partial Class frmChooseGame
End Sub
Friend WithEvents lblChoose As System.Windows.Forms.Label
Friend WithEvents btnChoose As System.Windows.Forms.Button
Friend WithEvents lstGameBox As System.Windows.Forms.ListBox
Friend WithEvents btnCancel As Button
Friend WithEvents lstGameBox As ListView
End Class
+18 -15
View File
@@ -25,24 +25,25 @@ Public Class frmChooseGame
End Set
End Property
Private Sub FillComboBox()
Private Sub FillList()
Dim sTags As String
Dim sName As String
lstGameBox.ValueMember = "Key"
lstGameBox.DisplayMember = "Value"
Dim oListViewItem As ListViewItem
lstGameBox.BeginUpdate()
lstGameBox.Columns.Add(frmChooseGame_ColumnName, 180)
lstGameBox.Columns.Add(frmChooseGame_ColumnTags, 175)
For Each o As clsGame In Process.DuplicateList
sTags = mgrGameTags.PrintTagsbyID(o.ID)
If sTags <> String.Empty Then
sName = o.Name & " (" & sTags & ")"
Else
sName = o.Name
End If
lstGameBox.Items.Add(New KeyValuePair(Of String, String)(o.ID, sName))
oListViewItem = New ListViewItem(New String() {o.Name, sTags})
oListViewItem.Tag = o.ID
If lstGameBox.Items.Count = 0 Then oListViewItem.Selected = True
lstGameBox.Items.Add(oListViewItem)
oGamesHash.Add(o.ID, o)
Next
lstGameBox.SelectedIndex = 0
lstGameBox.EndUpdate()
End Sub
Private Sub SaveSelection()
@@ -51,8 +52,8 @@ Public Class frmChooseGame
End Sub
Private Sub GetSelection()
Dim oSelected As KeyValuePair(Of String, String) = lstGameBox.SelectedItem
oGame = DirectCast(oGamesHash.Item(oSelected.Key), clsGame)
Dim oSelected As String = lstGameBox.SelectedItems(0).Tag
oGame = DirectCast(oGamesHash.Item(oSelected), clsGame)
SaveSelection()
bGameSelected = True
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
SetForm()
FillComboBox()
FillList()
Me.Focus()
End Sub
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
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 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>
''' Looks up a localized string similar to Choose Game.
'''</summary>
+6
View File
@@ -2374,4 +2374,10 @@
<data name="mgrCommon_FolderSelection" xml:space="preserve">
<value>Current Folder</value>
</data>
<data name="frmChooseGame_ColumnName" xml:space="preserve">
<value>Name</value>
</data>
<data name="frmChooseGame_ColumnTags" xml:space="preserve">
<value>Tags</value>
</data>
</root>