【发布时间】:2021-07-05 11:29:38
【问题描述】:
问题可能有点奇怪,但我需要在 Test() 方法结束之前执行 NavigationCompleted() 方法:
public Test()
{
WebView wb = new WebView(WebViewExecutionMode.SeparateProcess);
wb.Navigate(new Uri(@"Url"));
wb.NavigationCompleted += NavigationCompleted;
}
private async void NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
{
//some stuff
}
我不能在 Test() 方法中使用 Thread.Sleep() 因为在这种情况下 WebView 不能做它的东西,因此 NavigationCompleted() 只有在 Test() 方法完成后才会被调用。
【问题讨论】:
标签: uwp