// After the environment is successfully created, // register a handler for the NewVersionAvailable event. // This handler tells when there is a new Edge version available on the machine. private void OnNewVersionAvailable(NewVersionAvailableEventArgs args) { // Get the version value from args string newVersion = args.NewVersion; string message = "We detected there is a new version for the browser."; message += "\n\nVersion number: "; message += newVersion; message += "\n\n"; if (_webView2Control != null) { message += "Do you want to restart the app? \n\n"; message += "Click No if you only want to re-create the webviews. \n"; message += "Click Cancel for no action. \n"; } DialogResult response = MessageBox.Show(message, "New available version", (_webView2Control != null)? MessageBoxButtons.YesNoCancel:MessageBoxButtons.OK); if (response == DialogResult.Yes) { RestartApp(); } else if (response == DialogResult.No) { ReinitializeWebViewWithNewBrowser(); } else { // do nothing } }
private void _moveMouse_NewVersionAvailable(object sender, NewVersionAvailableEventArgs e) { try { _directUserToDownloadsOnBalloonClick = true; string balloonText = String.Format("Move Mouse {0} was released on {1}.\r\n", e.Version, e.Released.ToString("dd-MMM-yyyy")); if ((e.Features != null) && (e.Features.Length > 0)) { balloonText += "\r\nNew Features\r\n"; foreach (string feature in e.Features) { balloonText += String.Format(" - {0}\r\n", feature); } } if ((e.Fixes != null) && (e.Fixes.Length > 0)) { balloonText += "\r\nFixes\r\n"; foreach (string fix in e.Fixes) { balloonText += String.Format(" - {0}\r\n", fix); } } _downloadUrl = e.DownloadUrl; if (!String.IsNullOrEmpty(_downloadUrl)) { balloonText += "\r\nPlease click here to visit the downloads page."; } _sysTrayIcon.ShowBalloonTip(BalloonTipTimeout, "New Version Available", balloonText, ToolTipIcon.Info); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }