0

下面是一个网页示例,我希望可以在每 5 秒左右或单击按钮时选择刷新它。我只是看不到任何刷新页面的方法。

Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
    webview.Navigate(New Uri("http://www.google.com"))

End Sub

Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)

End Sub
4

2 回答 2

2

使用计时器:

Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded

     Dim t As Timer = New Timer()
     webview.Navigate(New Uri("http://www.google.com"))

     t.Tick += New EventHandler(Timer_Tick) ''For every tick, it will call the event
     t.Interval = 5000 ''Timer will tick every 5 seconds
     t.Enabled = True  ''Enable Timer
     t.Start()    ''Starts Timer

End Sub

Private Sub Timer_Tick (sender As Object, e As RoutedEventArgs)

    webView.Navigate(New Uri("http://www.google.com"))

End Sub
于 2013-05-24T00:59:50.443 回答
0

再次调用导航到网址应该可以解决问题,并且本质上是相同的

Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
    webview.Navigate(New Uri("http://www.google.com"))

End Sub

Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
     webview.Navigate(New Uri("http://www.google.com"))
End Sub

编辑:不使用按钮点击回答问题

在此处查看有关计时器以及如何使用它们的信息。

于 2013-05-23T21:57:45.337 回答