Usability updates for #22

This commit is contained in:
Michael J. Seiferling
2016-03-12 10:10:06 -06:00
parent a6341ffa76
commit 76ffc79a6b
4 changed files with 87 additions and 42 deletions
+5 -4
View File
@@ -44,7 +44,7 @@ Partial Class frmAdvancedImport
'chkSelectAll
'
Me.chkSelectAll.AutoSize = True
Me.chkSelectAll.Location = New System.Drawing.Point(15, 12)
Me.chkSelectAll.Location = New System.Drawing.Point(18, 12)
Me.chkSelectAll.Name = "chkSelectAll"
Me.chkSelectAll.Size = New System.Drawing.Size(15, 14)
Me.chkSelectAll.TabIndex = 0
@@ -97,11 +97,12 @@ Partial Class frmAdvancedImport
'
'lblFilter
'
Me.lblFilter.Location = New System.Drawing.Point(363, 12)
Me.lblFilter.Location = New System.Drawing.Point(307, 12)
Me.lblFilter.Name = "lblFilter"
Me.lblFilter.Size = New System.Drawing.Size(47, 14)
Me.lblFilter.Size = New System.Drawing.Size(103, 14)
Me.lblFilter.TabIndex = 0
Me.lblFilter.Text = "Search:"
Me.lblFilter.Text = "Filter:"
Me.lblFilter.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'frmAdvancedImport
'
+51 -19
View File
@@ -6,6 +6,7 @@ Public Class frmAdvancedImport
Private hshFinalData As New Hashtable
Private bSelectAll As Boolean = False
Private bIsLoading As Boolean = False
Private iCurrentSort As Integer = 0
Private WithEvents tmFilterTimer As Timer
Public Property ImportData As Hashtable
@@ -36,11 +37,20 @@ Public Class frmAdvancedImport
UpdateSelected()
End Sub
Private Sub SaveChecked(ByVal oItem As ListViewItem)
If oItem.Checked Then
FinalData.Add(oItem.Tag, ImportData(oItem.Tag))
Else
FinalData.Remove(oItem.Tag)
End If
End Sub
Private Sub LoadData(Optional ByVal sFilter As String = "")
Dim oApp As clsGame
Dim oListViewItem As ListViewItem
Dim sTags As String
Dim bAddItem As Boolean
Dim bResetSelectAll As Boolean = False
Cursor.Current = Cursors.WaitCursor
lstGames.BeginUpdate()
@@ -52,6 +62,7 @@ Public Class frmAdvancedImport
lstGames.Columns.Add(frmAdvancedImport_ColumnTags, 190)
For Each de As DictionaryEntry In ImportData
bAddItem = False
oApp = DirectCast(de.Value, clsGame)
sTags = String.Empty
oApp.ImportTags.Sort(AddressOf mgrCommon.CompareImportTagsByName)
@@ -62,21 +73,48 @@ Public Class frmAdvancedImport
oListViewItem = New ListViewItem(New String() {oApp.Name, oApp.TrueProcess, sTags})
oListViewItem.Tag = oApp.CompoundKey
oListViewItem.Checked = bSelectAll
If FinalData.ContainsKey(oApp.CompoundKey) Then
oListViewItem.Checked = True
Else
oListViewItem.Checked = False
End If
If sFilter = String.Empty Then
lstGames.Items.Add(oListViewItem)
bAddItem = True
Else
If oApp.Name.ToLower.Contains(sFilter.ToLower) Or oApp.TrueProcess.ToLower.Contains(sFilter.ToLower) Or sTags.ToLower.Contains(sFilter.ToLower) Then
lstGames.Items.Add(oListViewItem)
bAddItem = True
End If
End If
If bAddItem Then
If oListViewItem.Checked Then bResetSelectAll = True
lstGames.Items.Add(oListViewItem)
End If
Next
lstGames.ListViewItemSorter = New ListViewItemComparer(0)
'Change the status of the "Select All" checkbox depending on the status of the items filter results. Set loading flag so we don't trigger any events
bIsLoading = True
If Not bResetSelectAll And bSelectAll Then
bSelectAll = False
chkSelectAll.Checked = False
ElseIf bResetSelectAll And Not bSelectAll Then
bSelectAll = True
chkSelectAll.Checked = True
End If
bIsLoading = False
lstGames.ListViewItemSorter = New ListViewItemComparer(iCurrentSort)
lstGames.EndUpdate()
UpdateSelected()
lblGames.Text = mgrCommon.FormatString(frmAdvancedImport_NewConfigs, lstGames.Items.Count)
If txtFilter.Text = String.Empty Then
lblGames.Text = mgrCommon.FormatString(frmAdvancedImport_Configs, lstGames.Items.Count)
Else
lblGames.Text = mgrCommon.FormatString(frmAdvancedImport_Configs, lstGames.Items.Count) & " " & frmAdvancedImport_Filtered
End If
Cursor.Current = Cursors.Default
End Sub
@@ -97,17 +135,8 @@ Public Class frmAdvancedImport
tmFilterTimer.Enabled = False
End Sub
Private Sub BuildList()
Dim oData As ListViewItem
For i As Integer = 0 To lstGames.CheckedItems.Count - 1
oData = lstGames.Items(i)
FinalData.Add(oData.Tag, ImportData(oData.Tag))
Next
End Sub
Private Sub UpdateSelected()
lblSelected.Text = mgrCommon.FormatString(frmAdvancedImport_Selected, lstGames.CheckedItems.Count)
lblSelected.Text = mgrCommon.FormatString(frmAdvancedImport_Selected, FinalData.Count)
End Sub
Private Sub frmAdvancedImport_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@@ -123,7 +152,10 @@ Public Class frmAdvancedImport
End Sub
Private Sub lstGames_ItemChecked(sender As Object, e As ItemCheckedEventArgs) Handles lstGames.ItemChecked
If Not bIsLoading Then UpdateSelected()
SaveChecked(e.Item)
If Not bIsLoading Then
UpdateSelected()
End If
End Sub
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
@@ -131,12 +163,12 @@ Public Class frmAdvancedImport
End Sub
Private Sub btnImport_Click(sender As Object, e As EventArgs) Handles btnImport.Click
BuildList()
If ImportData.Count > 0 Then Me.DialogResult = Windows.Forms.DialogResult.OK
If FinalData.Count > 0 Then Me.DialogResult = Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub lstGames_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstGames.ColumnClick
iCurrentSort = e.Column
lstGames.ListViewItemSorter = New ListViewItemComparer(e.Column)
End Sub
+21 -12
View File
@@ -736,7 +736,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to Process.
''' Looks up a localized string similar to Monitored Process.
'''</summary>
Friend ReadOnly Property frmAdvancedImport_ColumnProcess() As String
Get
@@ -753,6 +753,24 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Configurations ([PARAM]).
'''</summary>
Friend ReadOnly Property frmAdvancedImport_Configs() As String
Get
Return ResourceManager.GetString("frmAdvancedImport_Configs", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to [Filtered].
'''</summary>
Friend ReadOnly Property frmAdvancedImport_Filtered() As String
Get
Return ResourceManager.GetString("frmAdvancedImport_Filtered", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Import Game Configurations.
'''</summary>
@@ -763,7 +781,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to Search:.
''' Looks up a localized string similar to Filter:.
'''</summary>
Friend ReadOnly Property frmAdvancedImport_lblFilter() As String
Get
@@ -772,16 +790,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to [PARAM] configurations available.
'''</summary>
Friend ReadOnly Property frmAdvancedImport_NewConfigs() As String
Get
Return ResourceManager.GetString("frmAdvancedImport_NewConfigs", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to [PARAM] Selected.
''' Looks up a localized string similar to Selected ([PARAM]).
'''</summary>
Friend ReadOnly Property frmAdvancedImport_Selected() As String
Get
+8 -5
View File
@@ -871,11 +871,11 @@
<data name="frmAdvancedImport_FormName" xml:space="preserve">
<value>Import Game Configurations</value>
</data>
<data name="frmAdvancedImport_NewConfigs" xml:space="preserve">
<value>[PARAM] configurations available</value>
<data name="frmAdvancedImport_Configs" xml:space="preserve">
<value>Configurations ([PARAM])</value>
</data>
<data name="frmAdvancedImport_Selected" xml:space="preserve">
<value>[PARAM] Selected</value>
<value>Selected ([PARAM])</value>
</data>
<data name="frmChooseGame_btnCancel" xml:space="preserve">
<value>&amp;Cancel</value>
@@ -1571,15 +1571,18 @@
<value>PNG files (*.png)|*.png</value>
</data>
<data name="frmAdvancedImport_lblFilter" xml:space="preserve">
<value>Search:</value>
<value>Filter:</value>
</data>
<data name="frmAdvancedImport_ColumnName" xml:space="preserve">
<value>Name</value>
</data>
<data name="frmAdvancedImport_ColumnProcess" xml:space="preserve">
<value>Process</value>
<value>Monitored Process</value>
</data>
<data name="frmAdvancedImport_ColumnTags" xml:space="preserve">
<value>Tags</value>
</data>
<data name="frmAdvancedImport_Filtered" xml:space="preserve">
<value>[Filtered]</value>
</data>
</root>