Esempio n. 1
0
        private void WebView_CoreWebView2InitializationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e)
        {
            if (webView.CoreWebView2 != null)
            {
                // Disable right click menu
                webView.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;

                // Add system service
                webView.CoreWebView2.AddHostObjectToScript("systemService", new SystemService());
            }
        }
Esempio n. 2
0
        private void Wv2_CoreWebView2InitializationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e)
        {
            if (!e.IsSuccess)
            {
                System.Diagnostics.Trace.WriteLine($"Webview 2 exception {e.InitializationException} {e.InitializationException?.StackTrace}");
            }

            LoadResult(e.IsSuccess);

            if (e.IsSuccess)
            {
                wv2.CoreWebView2.Settings.IsPasswordAutosaveEnabled = true;     // enable password saving
                wv2.CoreWebView2.FrameNavigationStarting           += CoreWebView2_FrameNavigationStarting;
            }
        }
Esempio n. 3
0
        private async void WebView2_CoreWebView2InitializationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e)
        {
            if (Deferral != null)
            {
                Deferral.Complete();
            }
            else
            {
                Console.WriteLine("Deferral Is NULL...");
            }

            //
            string script_id = await WebView2.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync(Properties.Resources.systemjs);

            WebView2.CoreWebView2.NavigationCompleted += CoreWebView2_NavigationCompleted;

            //
            Console.WriteLine("WebView2Manager-WebView2_CoreWebView2InitializationCompleted");
        }
Esempio n. 4
0
 private void WebView_CoreWebView2InitializationCompleted(object?sender, Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e)
 {
     statusLabel.Text = "";
 }
Esempio n. 5
0
        private async void WebView21_CoreWebView2InitializationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e)
        {
            //
            if (Deferral != null)
            {
                Deferral.Complete();
            }

            //
            Console.WriteLine("NewWindow:CoreWebView2InitializationCompleted");

            webView21.CoreWebView2.NavigationCompleted      += CoreWebView2_NavigationCompleted;
            webView21.CoreWebView2.FrameNavigationCompleted += CoreWebView2_FrameNavigationCompleted;
            webView21.CoreWebView2.NewWindowRequested       += CoreWebView2_NewWindowRequested;

            //
            string script_id = await webView21.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync(Resources.systemjs);

            Console.WriteLine($"NewWindow:AddScriptToExecuteOnDocumentCreatedAsync Completed, ScriptID: {script_id}");
        }