Added more filter options
This commit is contained in:
Generated
+46
-2
@@ -29,6 +29,10 @@ Partial Class frmFilter
|
|||||||
Me.btnAdd = New System.Windows.Forms.Button()
|
Me.btnAdd = New System.Windows.Forms.Button()
|
||||||
Me.lstFilter = New System.Windows.Forms.ListBox()
|
Me.lstFilter = New System.Windows.Forms.ListBox()
|
||||||
Me.lstTags = New System.Windows.Forms.ListBox()
|
Me.lstTags = New System.Windows.Forms.ListBox()
|
||||||
|
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
|
||||||
|
Me.optAll = New System.Windows.Forms.RadioButton()
|
||||||
|
Me.optAny = New System.Windows.Forms.RadioButton()
|
||||||
|
Me.GroupBox1.SuspendLayout()
|
||||||
Me.SuspendLayout()
|
Me.SuspendLayout()
|
||||||
'
|
'
|
||||||
'btnOK
|
'btnOK
|
||||||
@@ -82,7 +86,7 @@ Partial Class frmFilter
|
|||||||
Me.lstFilter.Location = New System.Drawing.Point(222, 24)
|
Me.lstFilter.Location = New System.Drawing.Point(222, 24)
|
||||||
Me.lstFilter.Name = "lstFilter"
|
Me.lstFilter.Name = "lstFilter"
|
||||||
Me.lstFilter.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
|
Me.lstFilter.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
|
||||||
Me.lstFilter.Size = New System.Drawing.Size(150, 199)
|
Me.lstFilter.Size = New System.Drawing.Size(150, 173)
|
||||||
Me.lstFilter.TabIndex = 11
|
Me.lstFilter.TabIndex = 11
|
||||||
'
|
'
|
||||||
'lstTags
|
'lstTags
|
||||||
@@ -91,14 +95,49 @@ Partial Class frmFilter
|
|||||||
Me.lstTags.Location = New System.Drawing.Point(12, 24)
|
Me.lstTags.Location = New System.Drawing.Point(12, 24)
|
||||||
Me.lstTags.Name = "lstTags"
|
Me.lstTags.Name = "lstTags"
|
||||||
Me.lstTags.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
|
Me.lstTags.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
|
||||||
Me.lstTags.Size = New System.Drawing.Size(150, 199)
|
Me.lstTags.Size = New System.Drawing.Size(150, 173)
|
||||||
Me.lstTags.TabIndex = 8
|
Me.lstTags.TabIndex = 8
|
||||||
'
|
'
|
||||||
|
'GroupBox1
|
||||||
|
'
|
||||||
|
Me.GroupBox1.Controls.Add(Me.optAll)
|
||||||
|
Me.GroupBox1.Controls.Add(Me.optAny)
|
||||||
|
Me.GroupBox1.Location = New System.Drawing.Point(12, 206)
|
||||||
|
Me.GroupBox1.Name = "GroupBox1"
|
||||||
|
Me.GroupBox1.Size = New System.Drawing.Size(150, 46)
|
||||||
|
Me.GroupBox1.TabIndex = 14
|
||||||
|
Me.GroupBox1.TabStop = False
|
||||||
|
Me.GroupBox1.Text = "Matching Options"
|
||||||
|
'
|
||||||
|
'optAll
|
||||||
|
'
|
||||||
|
Me.optAll.AutoSize = True
|
||||||
|
Me.optAll.Location = New System.Drawing.Point(77, 19)
|
||||||
|
Me.optAll.Name = "optAll"
|
||||||
|
Me.optAll.Size = New System.Drawing.Size(63, 17)
|
||||||
|
Me.optAll.TabIndex = 0
|
||||||
|
Me.optAll.TabStop = True
|
||||||
|
Me.optAll.Text = "All Tags"
|
||||||
|
Me.optAll.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'optAny
|
||||||
|
'
|
||||||
|
Me.optAny.AutoSize = True
|
||||||
|
Me.optAny.Checked = True
|
||||||
|
Me.optAny.Location = New System.Drawing.Point(6, 19)
|
||||||
|
Me.optAny.Name = "optAny"
|
||||||
|
Me.optAny.Size = New System.Drawing.Size(65, 17)
|
||||||
|
Me.optAny.TabIndex = 1
|
||||||
|
Me.optAny.TabStop = True
|
||||||
|
Me.optAny.Text = "Any Tag"
|
||||||
|
Me.optAny.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
'frmFilter
|
'frmFilter
|
||||||
'
|
'
|
||||||
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(384, 261)
|
Me.ClientSize = New System.Drawing.Size(384, 261)
|
||||||
|
Me.Controls.Add(Me.GroupBox1)
|
||||||
Me.Controls.Add(Me.btnOK)
|
Me.Controls.Add(Me.btnOK)
|
||||||
Me.Controls.Add(Me.lblGameTags)
|
Me.Controls.Add(Me.lblGameTags)
|
||||||
Me.Controls.Add(Me.lblTags)
|
Me.Controls.Add(Me.lblTags)
|
||||||
@@ -113,6 +152,8 @@ Partial Class frmFilter
|
|||||||
Me.ShowIcon = False
|
Me.ShowIcon = False
|
||||||
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
|
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
|
||||||
Me.Text = "Filter by Tags"
|
Me.Text = "Filter by Tags"
|
||||||
|
Me.GroupBox1.ResumeLayout(False)
|
||||||
|
Me.GroupBox1.PerformLayout()
|
||||||
Me.ResumeLayout(False)
|
Me.ResumeLayout(False)
|
||||||
Me.PerformLayout()
|
Me.PerformLayout()
|
||||||
|
|
||||||
@@ -124,4 +165,7 @@ Partial Class frmFilter
|
|||||||
Friend WithEvents btnAdd As System.Windows.Forms.Button
|
Friend WithEvents btnAdd As System.Windows.Forms.Button
|
||||||
Friend WithEvents lstFilter As System.Windows.Forms.ListBox
|
Friend WithEvents lstFilter As System.Windows.Forms.ListBox
|
||||||
Friend WithEvents lstTags As System.Windows.Forms.ListBox
|
Friend WithEvents lstTags As System.Windows.Forms.ListBox
|
||||||
|
Friend WithEvents GroupBox1 As GroupBox
|
||||||
|
Friend WithEvents optAll As RadioButton
|
||||||
|
Friend WithEvents optAny As RadioButton
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
+22
-4
@@ -1,16 +1,25 @@
|
|||||||
Public Class frmFilter
|
Public Class frmFilter
|
||||||
|
|
||||||
|
Public Enum eFilterType As Integer
|
||||||
|
Any = 1
|
||||||
|
All = 2
|
||||||
|
End Enum
|
||||||
|
|
||||||
Dim oFilters As New List(Of clsTag)
|
Dim oFilters As New List(Of clsTag)
|
||||||
|
Dim eCurrentFilterType As eFilterType = eFilterType.Any
|
||||||
Dim hshTags As New Hashtable
|
Dim hshTags As New Hashtable
|
||||||
Dim bShutdown As Boolean = False
|
Dim bShutdown As Boolean = False
|
||||||
|
|
||||||
Public Property Filters As List(Of clsTag)
|
Public ReadOnly Property Filters As List(Of clsTag)
|
||||||
Get
|
Get
|
||||||
Return oFilters
|
Return oFilters
|
||||||
End Get
|
End Get
|
||||||
Set(value As List(Of clsTag))
|
End Property
|
||||||
oFilters = value
|
|
||||||
End Set
|
Public ReadOnly Property FilterType As eFilterType
|
||||||
|
Get
|
||||||
|
Return eCurrentFilterType
|
||||||
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private Sub AddTag()
|
Private Sub AddTag()
|
||||||
@@ -87,10 +96,19 @@
|
|||||||
Dim oData As KeyValuePair(Of String, String)
|
Dim oData As KeyValuePair(Of String, String)
|
||||||
Dim oTag As clsTag
|
Dim oTag As clsTag
|
||||||
|
|
||||||
|
'Set Tags
|
||||||
For Each oData In lstFilter.Items
|
For Each oData In lstFilter.Items
|
||||||
oTag = DirectCast(hshTags(oData.Value), clsTag)
|
oTag = DirectCast(hshTags(oData.Value), clsTag)
|
||||||
Filters.Add(oTag)
|
Filters.Add(oTag)
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
'Set Filter Type
|
||||||
|
If optAll.Checked Then
|
||||||
|
eCurrentFilterType = eFilterType.All
|
||||||
|
Else
|
||||||
|
eCurrentFilterType = eFilterType.Any
|
||||||
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub frmGameTags_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub frmGameTags_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
|||||||
@@ -207,14 +207,16 @@ Public Class frmGameManager
|
|||||||
Dim oBackup As clsBackup
|
Dim oBackup As clsBackup
|
||||||
Dim frm As frmFilter
|
Dim frm As frmFilter
|
||||||
Dim oFilters As New List(Of clsTag)
|
Dim oFilters As New List(Of clsTag)
|
||||||
|
Dim eCurrentFilter As frmFilter.eFilterType = frmFilter.eFilterType.Any
|
||||||
|
|
||||||
If optTag.Checked Then
|
If optTag.Checked Then
|
||||||
frm = New frmFilter
|
frm = New frmFilter
|
||||||
frm.ShowDialog()
|
frm.ShowDialog()
|
||||||
oFilters = frm.Filters
|
oFilters = frm.Filters
|
||||||
|
eCurrentFilter = frm.FilterType
|
||||||
End If
|
End If
|
||||||
|
|
||||||
AppData = mgrMonitorList.ReadFilteredList(oFilters)
|
AppData = mgrMonitorList.ReadFilteredList(oFilters, eCurrentFilter)
|
||||||
|
|
||||||
If optPendingRestores.Checked Then
|
If optPendingRestores.Checked Then
|
||||||
oRestoreData = mgrRestore.CompareManifests
|
oRestoreData = mgrRestore.CompareManifests
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ Public Class mgrMonitorList
|
|||||||
Dim bSuccess As Boolean = False
|
Dim bSuccess As Boolean = False
|
||||||
|
|
||||||
frm.ShowDialog()
|
frm.ShowDialog()
|
||||||
oList = ReadListForExport(frm.Filters)
|
oList = ReadListForExport(frm.Filters, frm.FilterType)
|
||||||
|
|
||||||
bSuccess = mgrXML.SerializeAndExport(oList, sLocation)
|
bSuccess = mgrXML.SerializeAndExport(oList, sLocation)
|
||||||
|
|
||||||
@@ -258,15 +258,17 @@ Public Class mgrMonitorList
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Shared Function ReadFilteredList(ByVal oFilters As List(Of clsTag), Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable
|
Public Shared Function ReadFilteredList(ByVal oFilters As List(Of clsTag), ByVal eFilterType As frmFilter.eFilterType, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Hashtable
|
||||||
Dim oDatabase As New mgrSQLite(iSelectDB)
|
Dim oDatabase As New mgrSQLite(iSelectDB)
|
||||||
Dim oData As DataSet
|
Dim oData As DataSet
|
||||||
Dim sSQL As String
|
Dim sSQL As String = String.Empty
|
||||||
Dim hshList As New Hashtable
|
Dim hshList As New Hashtable
|
||||||
Dim oGame As clsGame
|
Dim oGame As clsGame
|
||||||
Dim hshParams As New Hashtable
|
Dim hshParams As New Hashtable
|
||||||
Dim iCounter As Integer = 0
|
Dim iCounter As Integer = 0
|
||||||
|
|
||||||
|
Select Case eFilterType
|
||||||
|
Case frmFilter.eFilterType.Any
|
||||||
If oFilters.Count > 0 Then
|
If oFilters.Count > 0 Then
|
||||||
sSQL = "SELECT DISTINCT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist "
|
sSQL = "SELECT DISTINCT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist "
|
||||||
sSQL &= "NATURAL JOIN gametags WHERE gametags.TagID IN ("
|
sSQL &= "NATURAL JOIN gametags WHERE gametags.TagID IN ("
|
||||||
@@ -282,6 +284,20 @@ Public Class mgrMonitorList
|
|||||||
Else
|
Else
|
||||||
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist ORDER BY Name Asc"
|
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist ORDER BY Name Asc"
|
||||||
End If
|
End If
|
||||||
|
Case frmFilter.eFilterType.All
|
||||||
|
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist WHERE MonitorID IN "
|
||||||
|
|
||||||
|
For Each oTag As clsTag In oFilters
|
||||||
|
sSQL &= "(SELECT MonitorID FROM gametags WHERE monitorlist.MonitorID = gametags.MonitorID And TagID = @TagID" & iCounter & ")"
|
||||||
|
If iCounter <> oFilters.Count - 1 Then
|
||||||
|
sSQL &= " AND MonitorID IN "
|
||||||
|
End If
|
||||||
|
hshParams.Add("TagID" & iCounter, oTag.ID)
|
||||||
|
iCounter += 1
|
||||||
|
Next
|
||||||
|
|
||||||
|
sSQL &= " ORDER BY Name Asc"
|
||||||
|
End Select
|
||||||
|
|
||||||
oData = oDatabase.ReadParamData(sSQL, hshParams)
|
oData = oDatabase.ReadParamData(sSQL, hshParams)
|
||||||
|
|
||||||
@@ -319,7 +335,7 @@ Public Class mgrMonitorList
|
|||||||
Dim oGame As clsGame
|
Dim oGame As clsGame
|
||||||
Dim oDupeGame As clsGame
|
Dim oDupeGame As clsGame
|
||||||
|
|
||||||
sSQL = "SELECT * from monitorlist ORDER BY Name Asc"
|
sSQL = "Select * from monitorlist ORDER BY Name Asc"
|
||||||
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
|
oData = oDatabase.ReadParamData(sSQL, New Hashtable)
|
||||||
|
|
||||||
For Each dr As DataRow In oData.Tables(0).Rows
|
For Each dr As DataRow In oData.Tables(0).Rows
|
||||||
@@ -371,18 +387,21 @@ Public Class mgrMonitorList
|
|||||||
Return hshList
|
Return hshList
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Shared Function ReadListForExport(ByVal oFilters As List(Of clsTag), Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As List(Of Game)
|
Public Shared Function ReadListForExport(ByVal oFilters As List(Of clsTag), ByVal eFilterType As frmFilter.eFilterType, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As List(Of Game)
|
||||||
Dim oDatabase As New mgrSQLite(iSelectDB)
|
Dim oDatabase As New mgrSQLite(iSelectDB)
|
||||||
Dim oData As DataSet
|
Dim oData As DataSet
|
||||||
Dim sSQL As String
|
Dim sSQL As String = String.Empty
|
||||||
Dim sID As String
|
Dim sID As String
|
||||||
Dim oList As New List(Of Game)
|
Dim oList As New List(Of Game)
|
||||||
Dim oGame As Game
|
Dim oGame As Game
|
||||||
Dim hshParams As New Hashtable
|
Dim hshParams As New Hashtable
|
||||||
Dim iCounter As Integer = 0
|
Dim iCounter As Integer = 0
|
||||||
|
|
||||||
|
Select Case eFilterType
|
||||||
|
Case frmFilter.eFilterType.Any
|
||||||
If oFilters.Count > 0 Then
|
If oFilters.Count > 0 Then
|
||||||
sSQL = "SELECT DISTINCT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, ExcludeList FROM monitorlist NATURAL JOIN gametags WHERE gametags.TagID IN ("
|
sSQL = "SELECT DISTINCT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist "
|
||||||
|
sSQL &= "NATURAL JOIN gametags WHERE gametags.TagID IN ("
|
||||||
|
|
||||||
For Each oTag As clsTag In oFilters
|
For Each oTag As clsTag In oFilters
|
||||||
sSQL &= "@TagID" & iCounter & ","
|
sSQL &= "@TagID" & iCounter & ","
|
||||||
@@ -393,8 +412,22 @@ Public Class mgrMonitorList
|
|||||||
sSQL = sSQL.TrimEnd(",")
|
sSQL = sSQL.TrimEnd(",")
|
||||||
sSQL &= ") ORDER BY Name Asc"
|
sSQL &= ") ORDER BY Name Asc"
|
||||||
Else
|
Else
|
||||||
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, ExcludeList from monitorlist ORDER BY Name Asc"
|
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist ORDER BY Name Asc"
|
||||||
End If
|
End If
|
||||||
|
Case frmFilter.eFilterType.All
|
||||||
|
sSQL = "SELECT MonitorID, Name, Process, Path, AbsolutePath, FolderSave, FileType, TimeStamp, ExcludeList, ProcessPath, Icon, Hours, Version, Company, Enabled, MonitorOnly FROM monitorlist WHERE MonitorID IN "
|
||||||
|
|
||||||
|
For Each oTag As clsTag In oFilters
|
||||||
|
sSQL &= "(SELECT MonitorID FROM gametags WHERE monitorlist.MonitorID = gametags.MonitorID And TagID = @TagID" & iCounter & ")"
|
||||||
|
If iCounter <> oFilters.Count - 1 Then
|
||||||
|
sSQL &= " AND MonitorID IN "
|
||||||
|
End If
|
||||||
|
hshParams.Add("TagID" & iCounter, oTag.ID)
|
||||||
|
iCounter += 1
|
||||||
|
Next
|
||||||
|
|
||||||
|
sSQL &= " ORDER BY Name Asc"
|
||||||
|
End Select
|
||||||
|
|
||||||
oData = oDatabase.ReadParamData(sSQL, hshParams)
|
oData = oDatabase.ReadParamData(sSQL, hshParams)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user