Zooflow: Search tweaks
This commit is contained in:
@@ -71,27 +71,22 @@ Public Class frmFlowSearch2
|
||||
ToList()
|
||||
End Function
|
||||
|
||||
'Private Function LoadDateConstraints() As List(Of RadioGroupItem)
|
||||
' Return New List(Of RadioGroupItem) From {
|
||||
' New RadioGroupItem(SearchRunner.CREATED_TODAY, "Heute"),
|
||||
' New RadioGroupItem(SearchRunner.CREATED_TOMORROW, "Gestern"),
|
||||
' New RadioGroupItem(SearchRunner.CREATED_LAST_7_DAYS, "Letzte 7 Tage"),
|
||||
' New RadioGroupItem(SearchRunner.CREATED_MONTH_CURR, "Dieser Monat"),
|
||||
' New RadioGroupItem(SearchRunner.CREATED_LAST_7_DAYS, "Letzter Monat"),
|
||||
' New RadioGroupItem(SearchRunner.CREATED_YEAR_CURRENT, "Dieses Jahr"),
|
||||
' New RadioGroupItem(SearchRunner.CREATED_YEAR_LAST, "Letztes Jahr"),
|
||||
' New RadioGroupItem("NOTHING", "Keine Einschränkung")
|
||||
' }
|
||||
'End Function
|
||||
|
||||
Private Function LoadDateAttributes() As List(Of String)
|
||||
Return My.Tables.DTIDB_ATTRIBUTE.
|
||||
Dim oAttributes = My.Tables.DTIDB_ATTRIBUTE.
|
||||
AsEnumerable().
|
||||
Where(Function(row) CBool(row.Item("SYS_ATTRIBUTE")) = False).
|
||||
Where(Function(row) row.Item("TYP_ID") = 5 Or row.Item("TYP_ID") = 6).
|
||||
Select(Function(row) row.Item("ATTR_TITLE")).
|
||||
Cast(Of String).
|
||||
ToList()
|
||||
|
||||
If My.Application.User.Language = "de-DE" Then
|
||||
oAttributes.Add(IDB_ADDED_WHEN_String_German)
|
||||
Else
|
||||
oAttributes.Add(IDB_ADDED_WHEN_String_Englisch)
|
||||
End If
|
||||
|
||||
Return oAttributes
|
||||
End Function
|
||||
|
||||
|
||||
@@ -153,6 +148,10 @@ Public Class frmFlowSearch2
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Async Sub TileView1_ItemClick(sender As Object, e As TileViewItemClickEventArgs) Handles TileView1.ItemClick
|
||||
Await RunSearch2(GetTokens())
|
||||
End Sub
|
||||
|
||||
Private Async Function RunSearch2(pTokens As IEnumerable(Of Token)) As Threading.Tasks.Task
|
||||
Dim oHandle = StartUpdateUI()
|
||||
Dim oSearchTitle As String = "Suche"
|
||||
@@ -187,7 +186,7 @@ Public Class frmFlowSearch2
|
||||
Dim oToken = pTokens.First()
|
||||
oResult = Await SearchRunner.RunWithSearchTerm(oToken.TermValue, oDateFrom, oDateTo, oSearchTitle)
|
||||
Else
|
||||
oResult = Await SearchRunner.RunWithTokens(pTokens)
|
||||
oResult = Await SearchRunner.RunWithTokens(pTokens, oDateFrom, oDateTo, oSearchTitle)
|
||||
End If
|
||||
|
||||
' If there was an error, show the message
|
||||
@@ -216,77 +215,7 @@ Public Class frmFlowSearch2
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'Private Async Function RunSearch(pTokens As IEnumerable(Of Token)) As Threading.Tasks.Task
|
||||
' Dim oHandle = StartUpdateUI()
|
||||
|
||||
' If pTokens.Count = 0 Then
|
||||
' Exit Function
|
||||
' End If
|
||||
|
||||
' Try
|
||||
' Dim oDateFrom = DateEditFrom.EditValue
|
||||
' Dim oDateTo = DateEditTo.EditValue
|
||||
|
||||
' If CheckEdit1.IsOn = False Then
|
||||
' oDateTo = Nothing
|
||||
' End If
|
||||
|
||||
' SearchRunner.SetDateConstraint()
|
||||
' Dim oResult = Await SearchRunner.RunWithSearchTerm(String.Empty, oDateFrom, oDateTo, pTokens, "")
|
||||
|
||||
' If oResult.OK = False Then
|
||||
' SetStatusBarColor(Color.OrangeRed, Color.White)
|
||||
' End If
|
||||
|
||||
' lblResults.Caption = $"{oResult.Count} Ergebnisse"
|
||||
|
||||
' Catch ex As Exception
|
||||
' MsgBox(ex.Message)
|
||||
|
||||
' Finally
|
||||
' StopUpdateUI(oHandle)
|
||||
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Private Async Sub TileView1_ItemClick(sender As Object, e As TileViewItemClickEventArgs) Handles TileView1.ItemClick
|
||||
Await RunSearch2(GetTokens())
|
||||
|
||||
'Dim oHandle = StartUpdateUI()
|
||||
|
||||
'TokenEditEx1.Properties.Tokens.Clear()
|
||||
|
||||
'Try
|
||||
' Dim oSearch = TileView1.GetRow(TileView1.FocusedRowHandle)
|
||||
' Dim oSearchTitle As String = "Suche"
|
||||
|
||||
' If TypeOf oSearch Is PredefinedDateSearch Then
|
||||
' Dim oDateSearch As PredefinedDateSearch = oSearch
|
||||
' oSearchTitle = oDateSearch.DisplayName
|
||||
' SearchRunner.SetDateConstraint(oDateSearch.DateConstraint)
|
||||
' End If
|
||||
|
||||
' Dim oResult = Await SearchRunner.RunWithSearchTerm("", oSearchTitle)
|
||||
|
||||
' If oResult.OK = False Then
|
||||
' SetStatusBarColor(Color.OrangeRed, Color.White)
|
||||
' lblResults.Caption = oResult.ErrorMessage
|
||||
|
||||
' ElseIf oResult.Count = 0 Then
|
||||
' SetStatusBarColor(Color.OrangeRed, Color.White)
|
||||
' lblResults.Caption = $"Keine Ergebnisse"
|
||||
|
||||
' Else
|
||||
' lblResults.Caption = $"{oResult.Count} Ergebnisse"
|
||||
|
||||
' End If
|
||||
|
||||
'Catch ex As Exception
|
||||
' MsgBox(ex.Message)
|
||||
'Finally
|
||||
' StopUpdateUI(oHandle)
|
||||
'End Try
|
||||
End Sub
|
||||
|
||||
Private Function StartUpdateUI() As IOverlaySplashScreenHandle
|
||||
SetStatusBarColor(Color.FromArgb(255, 240, 240, 240), Color.Black)
|
||||
@@ -343,24 +272,22 @@ Public Class frmFlowSearch2
|
||||
DateEditTo.Enabled = CheckEdit1.IsOn
|
||||
End Sub
|
||||
|
||||
Private Sub SetTokens(Editor As TokenEdit, Tokens As IEnumerable(Of Token))
|
||||
Editor.Properties.Tokens.Clear()
|
||||
AddTokens(Editor, Tokens)
|
||||
Private Sub SetTokens(pEditor As TokenEdit, Tokens As IEnumerable(Of Token))
|
||||
pEditor.Properties.Tokens.Clear()
|
||||
AddTokens(pEditor, Tokens)
|
||||
End Sub
|
||||
|
||||
Private Sub ClearTokens(Editor As TokenEdit)
|
||||
'Editor.Properties.Tokens.Clear()
|
||||
|
||||
'TODO
|
||||
Private Sub ClearTokens(pEditor As TokenEdit)
|
||||
pEditor.EditValue = Nothing
|
||||
End Sub
|
||||
|
||||
Private Sub AddTokens(Editor As TokenEdit, Tokens As IEnumerable(Of Token))
|
||||
Private Sub AddTokens(pEditor As TokenEdit, Tokens As IEnumerable(Of Token))
|
||||
For Each oToken In Tokens
|
||||
Dim oTokenEditToken = New TokenEditToken With {
|
||||
.Description = oToken.ToString,
|
||||
.Value = oToken
|
||||
}
|
||||
Editor.Properties.Tokens.Add(oTokenEditToken)
|
||||
pEditor.Properties.Tokens.Add(oTokenEditToken)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
@@ -380,7 +307,13 @@ Public Class frmFlowSearch2
|
||||
End Sub
|
||||
|
||||
Private Sub ComboBoxDateAttributes_EditValueChanged(sender As Object, e As EventArgs) Handles ComboBoxDateAttributes.EditValueChanged
|
||||
SearchRunner.SetDateAttribute(ComboBoxDateAttributes.EditValue)
|
||||
Dim oEditValue As String = ComboBoxDateAttributes.EditValue
|
||||
|
||||
If oEditValue = IDB_ADDED_WHEN_String_German Or oEditValue = IDB_ADDED_WHEN_String_Englisch Then
|
||||
SearchRunner.SetDateAttribute()
|
||||
Else
|
||||
SearchRunner.SetDateAttribute(oEditValue)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub TokenEditEx1_Properties_TokenAdding(sender As Object, e As TokenEditTokenAddingEventArgs) Handles TokenEditEx1.Properties.TokenAdding
|
||||
@@ -431,4 +364,8 @@ Public Class frmFlowSearch2
|
||||
SearchRunner.SetTokenOperator(SearchRunner.TokenOperator.Or)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub TokenEditEx1_Properties_TokenAdded(sender As Object, e As TokenEditTokenAddedEventArgs) Handles TokenEditEx1.Properties.TokenAdded
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user