Zooflow: Custom Searches
This commit is contained in:
@@ -37,6 +37,7 @@ Namespace Search
|
||||
End Enum
|
||||
|
||||
Public Event NeedsRefresh As EventHandler(Of Integer)
|
||||
Public Event NeedsNewSavedSearch As EventHandler
|
||||
Public Event Closed As EventHandler(Of Integer)
|
||||
|
||||
Private Property _ActiveDateConstraint As String = String.Empty
|
||||
@@ -78,9 +79,9 @@ Namespace Search
|
||||
Public Function RunWithDataTable(pDatatable As DataTable, pTitle As String) As SearchResult
|
||||
Dim oParams = GetParams(pTitle)
|
||||
oParams.Results.Add(New DocumentResultList.DocumentResult() With {
|
||||
.Title = pTitle,
|
||||
.Datatable = pDatatable
|
||||
})
|
||||
.Title = pTitle,
|
||||
.Datatable = pDatatable
|
||||
})
|
||||
|
||||
If pDatatable.Rows.Count = 1 Then
|
||||
oParams.ShowFileList = False
|
||||
@@ -181,6 +182,16 @@ Namespace Search
|
||||
'AddHandler oForm.NeedsRefresh, AddressOf Form_NeedsRefresh
|
||||
AddHandler oForm.FormClosed, AddressOf Form_Closed
|
||||
|
||||
' Only setup event if it is actually used
|
||||
If NeedsNewSavedSearchEvent IsNot Nothing Then
|
||||
AddHandler oForm.NeedsNewSavedSearch, AddressOf Form_NeedsNewSavedSearch
|
||||
End If
|
||||
|
||||
' Only setup event if it is actually used
|
||||
If NeedsRefreshEvent IsNot Nothing Then
|
||||
AddHandler oForm.NeedsRefresh, AddressOf Form_NeedsRefresh
|
||||
End If
|
||||
|
||||
oForm.Show()
|
||||
|
||||
Return New SearchResult(oRowCount)
|
||||
@@ -194,6 +205,14 @@ Namespace Search
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Sub Form_NeedsNewSavedSearch(sender As Object, e As EventArgs)
|
||||
RaiseEvent NeedsNewSavedSearch(sender, e)
|
||||
End Sub
|
||||
|
||||
Private Sub Form_NeedsRefresh(sender As Object, e As Integer)
|
||||
RaiseEvent NeedsRefresh(sender, e)
|
||||
End Sub
|
||||
|
||||
Private Async Function GetDateConstraint(pDateFrom As Date, pDateTo As Date) As Task(Of String)
|
||||
Dim oSimpleDateConstraint = $"{_ActiveDateAttribute}~{_ActiveDateConstraint}"
|
||||
Dim oExplicitConstraint = Await MaybeSetExplicitDateConstraint(pDateFrom, pDateTo)
|
||||
|
||||
Reference in New Issue
Block a user