private void ButtonCheckForUpdates_Click(object sender, RoutedEventArgs e) { Version latestVersion; try { latestVersion = UpdatesHelper.GetLatestVersion(); } catch (CouldNotCheckForUpdatesException) { MessageBox.Show(Properties.Resources.messageBoxCheckForUpdatesError, "Bandcamp Downloader", MessageBoxButton.OK, MessageBoxImage.Error); return; } Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version; if (currentVersion.CompareTo(latestVersion) < 0) { // The latest version is newer than the current one var windowUpdate = new WindowUpdate() { ShowInTaskbar = true, WindowStartupLocation = WindowStartupLocation.CenterScreen, }; windowUpdate.Show(); } else { MessageBox.Show(String.Format(Properties.Resources.messageBoxNoUpdateAvailable, currentVersion), "Bandcamp Downloader", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void ButtonCheckForUpdates_Click(object sender, RoutedEventArgs e) { Version latestVersion = null; try { latestVersion = UpdatesHelper.GetLatestVersion(); } catch (CouldNotCheckForUpdatesException) { MessageBox.Show("An error occured while checking for updates. Please retry later.", "Bandcamp Downloader", MessageBoxButton.OK, MessageBoxImage.Error); return; } Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version; if (currentVersion.CompareTo(latestVersion) < 0) { // The latest version is newer than the current one String msgBoxText = "A new version is available:" + Environment.NewLine + "Current version = " + currentVersion + Environment.NewLine + "Latest version = " + latestVersion + Environment.NewLine + Environment.NewLine + "Would you like to go to the project website in order to download the latest version?"; if (MessageBox.Show(msgBoxText, "Bandcamp Downloader", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.Yes) == MessageBoxResult.Yes) { Process.Start(Constants.ProjectWebsite); } } else { MessageBox.Show("You already have the latest version available (" + currentVersion + ").", "Bandcamp Downloader", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void ButtonCheckForUpdates_Click(object sender, RoutedEventArgs e) { Version latestVersion; try { latestVersion = UpdatesHelper.GetLatestVersion(); } catch (CouldNotCheckForUpdatesException) { MessageBox.Show(Properties.Resources.messageBoxCheckForUpdatesError, "Bandcamp Downloader", MessageBoxButton.OK, MessageBoxImage.Error); return; } Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version; if (currentVersion.CompareTo(latestVersion) < 0) { // The latest version is newer than the current one if (MessageBox.Show(String.Format(Properties.Resources.messageBoxUpdateAvailable, currentVersion, latestVersion), "Bandcamp Downloader", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.Yes) == MessageBoxResult.Yes) { Process.Start(Constants.ProjectWebsite); } } else { MessageBox.Show(String.Format(Properties.Resources.messageBoxNoUpdateAvailable, currentVersion), "Bandcamp Downloader", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void WindowUpdate_Loaded(object sender, RoutedEventArgs e) { try { _latestVersion = UpdatesHelper.GetLatestVersion(); } catch (CouldNotCheckForUpdatesException) { // Do nothing return; } Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version; if (currentVersion.CompareTo(_latestVersion) < 0) { // The latest version is newer than the current one buttonDownloadUpdate.IsEnabled = true; } }
/// <summary> /// Displays a message if a new version is available. /// </summary> private void CheckForUpdates() { Version latestVersion; try { latestVersion = UpdatesHelper.GetLatestVersion(); } catch (CouldNotCheckForUpdatesException) { Dispatcher.BeginInvoke(new Action(() => { labelNewVersion.Content = Properties.Resources.labelVersionError; })); return; } Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version; if (currentVersion.CompareTo(latestVersion) < 0) { // The latest version is newer than the current one Dispatcher.BeginInvoke(new Action(() => { labelNewVersion.Content = Properties.Resources.labelVersionNewUpdateAvailable; })); } }