예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        private async void WindowUpdate_Loaded(object sender, RoutedEventArgs e)
        {
            try {
                _latestVersion = await UpdatesHelper.GetLatestVersionAsync();
            } catch (CouldNotCheckForUpdatesException) {
                // Do nothing, the button will stayed disabled
                return;
            }

            Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

            if (currentVersion.CompareTo(_latestVersion) < 0)
            {
                // The latest version is newer than the current one
                buttonDownloadUpdate.IsEnabled = true;
            }
        }
        private async void ButtonCheckForUpdates_Click(object sender, RoutedEventArgs e)
        {
            Version latestVersion;

            try {
                latestVersion = await UpdatesHelper.GetLatestVersionAsync();
            } catch (CouldNotCheckForUpdatesException) {
                var msgProperties = new WpfMessageBoxProperties()
                {
                    Button       = MessageBoxButton.OK,
                    ButtonOkText = Properties.Resources.messageBoxButtonOK,
                    Image        = MessageBoxImage.Error,
                    Text         = Properties.Resources.messageBoxCheckForUpdatesError,
                    Title        = "Bandcamp Downloader",
                };
                WpfMessageBox.Show(Window.GetWindow(this), ref msgProperties);

                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
            {
                var msgProperties = new WpfMessageBoxProperties()
                {
                    Button       = MessageBoxButton.OK,
                    ButtonOkText = Properties.Resources.messageBoxButtonOK,
                    Image        = MessageBoxImage.Information,
                    Text         = String.Format(Properties.Resources.messageBoxNoUpdateAvailable, currentVersion.ToString(3)),
                    Title        = "Bandcamp Downloader",
                };
                WpfMessageBox.Show(Window.GetWindow(this), ref msgProperties);
            }
        }
예제 #6
0
        /// <summary>
        /// Displays a message if a new version is available.
        /// </summary>
        private async Task CheckForUpdates()
        {
            Version latestVersion;

            try {
                latestVersion = await UpdatesHelper.GetLatestVersionAsync();
            } catch (CouldNotCheckForUpdatesException) {
                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
                labelNewVersion.Content = Properties.Resources.labelVersionNewUpdateAvailable;
            }
        }
예제 #7
0
        /// <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;
                }));
            }
        }