0

私の具体的な質問は、そのイベントハンドラーから呼び出された子フォームにあるときにWindowsイベントを無視する方法は?

いくつかのコンテキスト: 私のアプリケーションは指紋をキャプチャし、データベースに対して印刷が認識されると次のフォーム (secondForm) を表示します。secondForm が起動している間に入力されたプリントは無視したいと思います。問題は、人々が印刷を複数回押したとき、またはsecondFormが起動しているときに、secondFormが閉じるまでイベントがキューに入れられることです。そのため、その人のイベントハンドラーへの複数の呼び出しが発生します。これを回避する方法として、secondForm をデリゲートとして開くルーチンを呼び出す (それも適切です)、イベント ハンドラーにグローバル ブール値を配置するなどがあります。
ここであなたに明らかな何かが欠けていますか?どんなアイデアにも感謝します...

Imports DPFP.Capture ' DigitalPersona fingerprint reader library
' Simple example to capture a fingerprint from DigitalPersona fingerprint reader.
Public Class SimpleFP
Implements DPFP.Capture.EventHandler

Private mIgnore As Boolean
Public eventHandlerComplete As DPFP.Capture.EventHandler
Public WithEvents mCapture As DPFP.Capture.Capture

Private Sub WaitForFPrint_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Try
        ' set up finger print capture
        mCapture = New DPFP.Capture.Capture
        mCapture.EventHandler = Me
        mCapture.StartCapture()
    Catch ex As Exception
        MsgBox("Problem starting fingerprint reader: " & ex.Message)
    End Try
End Sub

Public Sub FPOnComplete(ByVal Capture As Object, ByVal sernum As String, ByVal sample As DPFP.Sample) _
    Implements DPFP.Capture.EventHandler.OnComplete

    'mCapture.StopCapture()  
    'This is what I want to do, but when I leave this in,  my secondForm won't stay up

    Dim s As String = displaySecondScreen(sample)

    showStatus(s)
    'mCapture.StartCapture()  
     'This is what I want to do, but when I leave this in,  my secondForm won't stay up
End Sub

' Put up second form. This is called from the fingerprint OnComplete event handler.
Private Function displaySecondScreen(ByVal sample As DPFP.Sample) As String

    Dim status As String = "OK"
    Try
        Dim x As DPFP.FeatureSet
        x = extractFeatures(sample)

        ' This is where I match the fp in my code, but I removed here to simplify
        If True Then

            Dim frm As New frmSecondForm
            frm.ShowDialog(Me)
            frm.Dispose()

        Else
            ' No fingerprint match - normal case
            status = "Fingerprint not recognized"
        End If
    Catch ex As Exception
        status = "Exception during fingerprint verification: " & ex.Message
    End Try
    Return status
End Function

' Made rudimentary for this example, but I thought some person new to dpfp  may be able to use this
Private Function extractFeatures(ByVal sample As DPFP.Sample) As DPFP.FeatureSet
    Dim extractor As New DPFP.Processing.FeatureExtraction()
    Dim feedback As New DPFP.Capture.CaptureFeedback()
    Dim features As New DPFP.FeatureSet()
    extractor.CreateFeatureSet(sample, DPFP.Processing.DataPurpose.Verification, feedback, features)
    If feedback = DPFP.Capture.CaptureFeedback.Good Then

    End If
    Return features
End Function

Private Sub debugOut(ByVal s As String)
    Console.WriteLine(s)
End Sub

' Display status on first form
Delegate Sub showStatusCallback(ByVal s As String)

Private Sub showStatus(ByVal s As String)
    If lblStatus.InvokeRequired Then
        Dim d As New showStatusCallback(AddressOf showStatus)
        Me.Invoke(d, New Object() {s})
    Else
        lblStatus.Text = s
    End If
End Sub

' ... followed by other implements dpfp eventhandlers not in use....
' ....

クラス終了

4

0 に答える 0