Private MergeBoxesIsTimeOut as Boolean = False
Private Sub MergeBoxesUILess(filename As String,srcMat As cvMat,horizontal As Boolean,Xweight As Double,Yweight As Double) As ResumableSub
MergeBoxesAsync(filename,srcMat,horizontal,Xweight,Yweight)
wait for Merged(Success As Boolean)
Return ""
End Sub
Sub MergeBoxesAsync(filename As String,srcMat As cvMat,horizontal As Boolean,Xweight As Double,Yweight As Double)
If MergeBoxesIsTimeOut Then
wait for (MergeBoxesUILessImpl(filename,srcMat,horizontal,Xweight,Yweight)) complete (done As Object)
CallSubDelayed2(Me, "Merged", True)
Else
Dim b() As Boolean = Array As Boolean(False)
MergeBoxesTimeOut(5000, b)
th.Start(Me,"MergeBoxesUILessImpl",Array(filename,srcMat,horizontal,Xweight,Yweight))
wait for th_Ended(endedOK As Boolean, error As String)
If b(0) = False Then
b(0) = True
CallSubDelayed2(Me, "Merged", True)
End If
End If
End Sub
Sub MergeBoxesTimeOut(Duration As Int, b() As Boolean)
Sleep(Duration)
If b(0) = False Then
MergeBoxesIsTimeOut = True
b(0) = True
Log("time out")
CallSubDelayed2(Me, "Merged", False)
End If
End Sub
Private Sub MergeBoxesUILessImpl(filename As String,srcMat As cvMat,horizontal As Boolean,Xweight As Double,Yweight As Double) As ResumableSub
'heavy work here
End Sub