Imports System.Threading.Tasks
Imports DigitalData.Modules.ZooFlow
Public Class frmGlobix_Result
    Private Search As Search.SearchRunner
    Private Property Environment As Environment
    Public Sub New()

        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()
        Environment = My.Application.GetEnvironment()
        ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
        Search = New Search.SearchRunner(My.LogConfig, Environment, "FlowSearch") With {
            .BaseSearchSQL = SQL_FLOW_SEARCH_BASE
        }
    End Sub

    Private Sub PictureEdit1_EditValueChanged(sender As Object, e As EventArgs) Handles PictureEdit1.EditValueChanged
        Close()
    End Sub
    Private Async Function GetResult(oVariant As String) As Task
        Dim oSql As String
        Try
            If oVariant = "DOCID" Then
                oSql = My.Queries.Common.DOCRESULT_DocID(My.Application.Globix.DOCUMENT_ID)
            ElseIf oVariant = "TODAY" Then
                oSql = My.Queries.Common.DOCRESULT_TODAY
            ElseIf oVariant = "TODAY_ME" Then
                oSql = My.Queries.Common.DOCRESULT_TODAY_ME
            End If
            If oSql IsNot Nothing Then
                Dim oResultDT = Await My.Database.GetDatatableIDBAsync(oSql)
                If Not IsNothing(oResultDT) Then
                    Search.RunWithDataTable(oResultDT, "FileFlow Duplicate File")
                End If

            End If

        Catch ex As Exception
            MsgBox("Unexpected error in getResult: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
        End Try
    End Function

    Private Async Sub SimpleButton3_Click(sender As Object, e As EventArgs) Handles SimpleButton3.Click
        Await GetResult("DOCID")
    End Sub
End Class