Callback 的使用应该如下所示:我省略了 for...each。
Private Sub StartTask_Click(sender As Object, e As RoutedEventArgs) Handles StartTask.Click
Dim LongTask As Task = (New System.Threading.Tasks.TaskFactory).StartNew(AddressOf DoWorkAsync)
LongTask.ContinueWith(AddressOf WorkCompleted)
Debug.Print("")
End Sub
''' <summary>
''' Called after DoWorkAsync Task is complete
''' </summary>
''' <remarks></remarks>
Private Sub WorkCompleted()
Debug.Print("completed")
End Sub
''' <summary>
''' Called by Task
''' </summary>
''' <remarks></remarks>
Public Sub DoWorkAsync()
For i = 0 To 2000
Debug.Print("test")
Next
End Sub