0
我試圖通過子例程來通知一些我的程序的觀察者動畫轉換已完成。但它告訴我不能直接調用,我需要使用RaiseEvent。我嘗試添加處理程序,但仍然無效。我該怎麼辦?通過子程序提高事件
Utility.raiseEventTest(Me.TransitionCompletedEvent, Me, New Transition.Args())
Public Shared Sub raiseEventTest(Of T As System.EventArgs)(theEvent As EventHandler(Of T), sender As Object, args As T)
If theEvent Is Nothing Then
Return
End If
'
For Each handler As EventHandler(Of T) In theEvent.GetInvocationList()
Try
Dim target As ISynchronizeInvoke = TryCast(handler.Target, ISynchronizeInvoke)
If target Is Nothing OrElse target.InvokeRequired = False Then
handler(sender, args)
Else
target.BeginInvoke(handler, New Object() {sender, args})
End If
Catch generatedExceptionName As Exception
End Try
Next
End Sub
感謝您的快速回答。遺憾的是仍然如此:http://prntscr.com/fihqnd – Mava