0
ListBoxには多くの要素が設定されています。だから、基本的に私は、主な仕事と仮定して、それが完了したら、ListBoxの次の要素に移動し、明らかにGUIを解放しながら、最後までプロセスを繰り返すことを考えているインスタンスのインスタンスを開始したい。セカンダリクラスの擬似コードを投稿して、それが動作していることをすべて理解できるようにします。私は、Connect()のスレッドで方法を置けばListBox内の各要素に対して、タスクを開始し、移動する前にタスクが完了するまで待ちます。
Imports System.Threading
Public Class Demo
Private Ip As String
Private Port As Integer
Private SW As SomeWork
Private mre As New ManualResetEvent(False)
Public Event OnPacket(ByVal Data As SomeMessage)
Sub New(ByVal Ip As String, ByVal Port As Integer)
'Self Explantory
End Sub
Sub Connect()
SW = New SomeWork(IP, Port)
SW.ProcessForMounting(AddressOf InitiateCallback, mre)
Validate(mre)
End Sub
Private Sub Validate(ByVal mre As ManualResetEvent)
'Some Work here
End Sub
Private Sub InitiateCallback(ByVal client As Example)
client.BufferCallbacks(AddressOf SomeCallBack, mre)
End Sub
Private Sub SomeCallBack(ByVal Data As SomeMessage)
'either this or raising the event on main gui
Dim type As String = Data.Type.ToString()
Select Case type
Case is = "Done"
' Finished work
' Writes something to the server and calls Done() method
' On the calling class, move to the next element
End Select
'Or RaiseEvent Packet(Data)
End Sub
Public Sub Done()
SW.Dispose()
SW = Nothing
End Sub
End Class
さて、問題は、がが
を完了受信する SomeCallBack()を待たずにメソッドの最後の行の後に終了するだろう、ですはもう一度それだけの擬似コード