Dim maxTries As Int = 10
Dim pdp As ProgressDialogPlus
pdp.Initialize
pdp.Show("Waiting for condition...", False, "Checking", "HORIZONTAL")
pdp.SetMax(maxTries)
Dim success As Boolean = False
For i = 1 To maxTries
' Simulate check
success = (Rnd(0, 10) = 3)
pdp.SetProgress(i)
pdp.SetMessage("Attempt " & i & "/" & maxTries)
If success Then Exit
Sleep(500)
Next
pdp.Dismiss
If success Then
ToastMessageShow("Confirmed!", False)
Else
Dim res As Int = Msgbox2("Condition not confirmed. Proceed anyway?", "Timeout", "Yes", "Cancel", "", Null)
If res = DialogResponse.POSITIVE Then
ToastMessageShow("Proceeding anyway.", False)
Else
ToastMessageShow("Cancelled.", False)
End If
End If