PDA

View Full Version : [vb .net] Interrompere il codice ed attendere che si carichi una pagina web


darklook
13-12-2016, 14:38
Vorrei cambiare pagina sospendendo il codice e riprendendolo una volta che la pagina è stata caricata. Sto usando awesomium come form e premetto che non voglio usare l'evento loadfreamecompleted.
Ho testato che il Doevents da problemi quindi non resta da usare un thread ma mi trovo in alto mare perche il form non si carica mai.

questo è il mio codice:


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
docLoad("MIO URL")
End Sub


Public Sub docLoad(ByVal uri As String)
Dim t As New Threading.Thread(AddressOf threadLoad)
t.Start(uri)
MsgBox(WebControl1.IsDocumentReady)
End Sub
Public Sub threadLoad(ByVal uri As String)
If WebControl1.InvokeRequired Then
Invoke(New setLoad(AddressOf threadLoad), uri)
Else
WebControl1.Source = New Uri(uri)
End If
End Sub


Delegate Sub setLoad([uri] As String)

potete aiutarmi a capire cosa sbaglio?