// Kick off Source1 (trigger creation), then Source2 while 1 is in progress public void OnSource_Source_ButtonClicked(object sender, RoutedEventArgs args) { if (_wv2_ConcurrentCreation != null) { // We'll set Source #2 in this special CWV2Initialized Handler _wv2_ConcurrentCreation.CoreWebView2Initialized += OnCoreWebView2Initialized_Source; // Set Source #1 and attach special CoreWebView2Initialized handler to apply Source #2 at that time WebView2Common.NavigateToUri(_wv2_ConcurrentCreation, WebView2Common.GetTestPageUri("SimplePage.html")); } }
public void OnSource_Ensure_ButtonClicked(object sender, RoutedEventArgs args) { if (_wv2_ConcurrentCreation != null) { // We'll call EnsureCWV2() in this special CWV2Initialized Handler _wv2_ConcurrentCreation.CoreWebView2Initialized += OnCoreWebView2Initialized_Ensure; // Set Source #1 WebView2Common.NavigateToUri(_wv2_ConcurrentCreation, WebView2Common.GetTestPageUri("SimplePage.html")); } }
public void OnGood_Source_ButtonClicked(object sender, RoutedEventArgs args) { if (_wv2_CoreProcessFailed != null) { try { WebView2Common.NavigateToUri(_wv2_CoreProcessFailed, WebView2Common.GetTestPageUri("SimplePage.html")); } catch (Exception e) { SetClosedExceptionCount(_closedExceptionCount + 1); string s = string.Format("{0} Caught exception: {1}", _wv2_CoreProcessFailed.Name, e.ToString()); _helpers.AppendMessage(s); Status2.Text = Status2.Text + " " + s; } } }
private void OnBadSourceButtonClickedHelper(string badUri) { if (_wv2_CoreProcessFailed != null) { try { WebView2Common.NavigateToUri(_wv2_CoreProcessFailed, new Uri(badUri)); } catch (Exception e) { SetClosedExceptionCount(_closedExceptionCount + 1); string s = string.Format("{0} Caught exception: {1}", _wv2_CoreProcessFailed.Name, e.ToString()); _helpers.AppendMessage(s); Status2.Text = Status2.Text + " " + s; } } }
// Set Source from OnCoreWebView2Initialized handler (for ConcurrentCreationRequestsTest) private void OnCoreWebView2Initialized_Source(WebView2 sender, object args) { sender.CoreWebView2Initialized -= OnCoreWebView2Initialized_Source; // Don't spin creation on next CWV2Initialized! WebView2Common.NavigateToUri(sender, WebView2Common.GetTestPageUri("SimplePageWithButton.html")); }