protected virtual void OnEnvironmentCreated(EnvironmentCreatedEventArgs e)
 {
     if (EnvironmentCreated != null)
     {
         EnvironmentCreated(this, e);
     }
 }
        /// <summary>
        /// Raises the <see cref="WebView2EnvironmentCreated"/ event.
        /// </summary>
        /// <param name="args"></param>
        private void OnWebView2EnvironmentCreated(EnvironmentCreatedEventArgs args)
        {
            _webViewEnvironment = args.WebViewEnvironment;

            OnEnvironmentCreated(args);

            if (args.Result == 0)
            {
                _webViewEnvironment.CreateWebView(Handle, OnWebViewCreated);
            }
        }
Пример #3
0
 private void OnEnvironmentCreated(object sender, EnvironmentCreatedEventArgs e)
 {
     if (e.Result != 0)
     {
         if (e.Result == 2)
         {
             throw new InvalidOperationException("Couldn't find Edge installation. Do you have a version installed that's compatible with this WebView2 SDK version?");
         }
         else
         {
             throw new InvalidOperationException("Failed to create webview environment. Error: " + e.Result);
         }
     }
 }
Пример #4
0
 private void webView2Control1_EnvironmentCreated(object sender, EnvironmentCreatedEventArgs e)
 {
     if (e.Result != 0)
     {
         if (e.Result == 2)
         {
             MessageBox.Show("Couldn't find Edge installation. Do you have a version installed that's compatible with this WebView2 SDK version?",
                             "Error", MessageBoxButtons.OK);
         }
         else
         {
             CommonDialogs.ShowFailure(e.Result, "Failed to create webview environment");
         }
         return;
     }
     _environment     = e.WebViewEnvironment;
     _newVersionToken = _environment.RegisterNewVersionAvailable(OnNewVersionAvailable);
 }
Пример #5
0
        //protected override void OnResize(EventArgs e)
        //{
        //    ResizeUIWebViews();

        //    base.OnResize(e);
        //}

        private void controlsWebView2_EnvironmentCreated(object sender, EnvironmentCreatedEventArgs e)
        {
            _controlEnvironment = e.WebViewEnvironment;
        }
Пример #6
0
 private void webView2Control2_EnvironmentCreated(object sender, EnvironmentCreatedEventArgs e)
 {
     _contentEnvironment = e.WebViewEnvironment;
 }