ZooFlow: Easier Filter

This commit is contained in:
Jonathan Jenne
2020-11-12 16:27:01 +01:00
parent 6b4010232d
commit 3e84c7bdcb
6 changed files with 648 additions and 120 deletions

View File

@@ -58,8 +58,8 @@ Public Class frmSearchStart
Next
RepositoryItemComboBox2.Items.AddRange(New List(Of FilterTimeframe) From {
New FilterTimeframe() With {.Name = "Alle", .From = Nothing, .[To] = Nothing},
New FilterTimeframe() With {.Name = "Eigener", .From = Nothing, .[To] = Nothing},
New FilterTimeframe() With {.Name = "Kein", .DisableFilter = True},
New FilterTimeframe() With {.Name = "Eigener", .CustomFilter = True},
New FilterTimeframe() With {
.Name = "letzte 7 Tage",
.From = Date.Now.Subtract(TimeSpan.FromDays(7)),
@@ -69,6 +69,11 @@ Public Class frmSearchStart
.Name = "letzte 14 Tage",
.From = Date.Now.Subtract(TimeSpan.FromDays(14)),
.[To] = Date.Now
},
New FilterTimeframe() With {
.Name = "letzte 30 Tage",
.From = Date.Now.Subtract(TimeSpan.FromDays(30)),
.[To] = Date.Now
}
})
@@ -926,18 +931,12 @@ Public Class frmSearchStart
End If
End Sub
Private Sub SwitchFilter_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SwitchFilter.CheckedChanged
If SwitchFilter.Checked Then
RibbonPageGroupFilter.Enabled = True
Else
RibbonPageGroupFilter.Enabled = False
End If
End Sub
Private Class FilterTimeframe
Public Property Name As String
Public Property From As Date
Public Property [To] As Date
Public Property DisableFilter As Boolean = False
Public Property CustomFilter As Boolean = False
Public Overrides Function ToString() As String
Return Name.ToString
@@ -947,11 +946,17 @@ Public Class frmSearchStart
Private Sub cmbFilterTimeframe_EditValueChanged(sender As Object, e As EventArgs) Handles cmbFilterTimeframe.EditValueChanged
Dim oTimeframe As FilterTimeframe = DirectCast(cmbFilterTimeframe.EditValue, FilterTimeframe)
If IsNothing(oTimeframe.From) And IsNothing(oTimeframe.To) Then
If oTimeframe.DisableFilter Then
txtFilterFrom.Enabled = False
txtFilterFrom.Reset()
txtFilterTo.Enabled = False
txtFilterTo.Reset()
Else
txtFilterFrom.Enabled = True
txtFilterFrom.EditValue = oTimeframe.From
txtFilterTo.Enabled = True
txtFilterTo.EditValue = oTimeframe.[To]
End If