Esempio n. 1
0
 private void Installer_InstallProgress(Webview2Installer sender, EventArgs e)
 {
     Application.Current.Dispatcher.Invoke(() => {
         if (sender.downloadProgress < 100)
         {
             installingLabel.Content = $"Downloading Webview2: {sender.downloadProgress}%";
         }
         else
         {
             installingLabel.Content = "Installing Webview2...";
         }
     });
 }
Esempio n. 2
0
        private void Installer_InstallCompleted(Webview2Installer sender, EventArgs e)
        {
            Application.Current.Dispatcher.Invoke(() => {
                installingLabel.Content = "Webview2 install completed";
                Activate();

                if (sender.exitCode != 0)
                {
                    var message = $"Webview2 install FAILED with code {sender.exitCode}. Try again.";
                    MessageBox.Show(message, "Install failed");
                }

                // Reopen window
                var window = new MainWindow();
                window.Show();
                Close();
            });
        }
Esempio n. 3
0
        private void PromptToInstallWebview2()
        {
            var dialogResult = MessageBox.Show(
                "Focalboard requires the WebView2 runtime to be downloaded and installed. Install now?",
                "Focalboard",
                MessageBoxButton.YesNo,
                MessageBoxImage.Information,
                MessageBoxResult.OK,
                MessageBoxOptions.DefaultDesktopOnly);

            if (dialogResult == MessageBoxResult.Yes)
            {
                installingLabel.Visibility = Visibility.Visible;
                webView.Visibility         = Visibility.Collapsed;

                var installer = new Webview2Installer();
                installer.InstallProgress  += Installer_InstallProgress;
                installer.InstallCompleted += Installer_InstallCompleted;
                installer.DownloadAndInstall();
            }
        }