Sub WelcomePageButton_Click (event As BANanoEvent)
' wait for an event from another control like here the first KeyUp of an SKTextBox
Log("Waiting for a key up...")
' the code will stop here until I have done a Key Up in the WelcomePageName SKTextBox
Wait For WelcomePageName_KeyUp (event As BANanoEvent)
Log("Got a Key Up: " & event.KeyCode)
' simple wait with a sleep
wait for LogSleepJos
' wait for a long method and return the result
Wait For (DoSum(10,20)) Complete(Result As Int)
Log(Result)
' alternative way also supported
Dim Sum As ResumableSub = DoSumSleep(30,50)
wait for (Sum) complete(Result As Int)
Log(Result)
' getting the json from a file on the server
wait for (GetFile) Complete(Json As Object)
Log(Json)
' or an alternative without a seperate sub
Dim GetFileDirect As ResumableSub = BANano.GetFileAsJSON("https://127.0.0.1:8080/manifest.json", Null)
wait for (GetFileDirect) Complete (Json As Object)
Log(Json)
Log("Done")
End Sub
Sub LogSleepJos()
Log("Sleeping...")
Sleep(1000)
Log("Jos")
End Sub
Sub DoSum(a As Int, b As Int) As ResumableSub
Return a + b
End Sub
Sub DoSumSleep(a As Int, b As Int) As ResumableSub
Log("Sleeping Sum...")
Sleep(1000)
Return a + b
End Sub
Sub GetFile() As ResumableSub
Return BANano.GetFileAsJSON("https://127.0.0.1:8080/manifest.json", Null)
End Sub