下面是一个网页示例,我希望每隔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
答案 0 :(得分: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
答案 1 :(得分:0)
再次调用导航到url应该可以解决问题,并且基本上是相同的事情
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
编辑:不使用按钮回答问题点击
请查看here,了解有关计时器及其使用方法的信息。