Exemple #1
0
        private void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show("yo");
            //DownloadProgBar.Value = 100;
            VersionInfo info = ProgramConfigReader.GetLatestVersion();

            if (info.NewVersion == "NOT AVAILABLE")
            {
                MessageBox.Show("Cannot contact update server", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            if (info.NewVersion == CurrentVersion)
            {
                MessageBox.Show("Program up to date", "Update Checker", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBoxResult result = MessageBox.Show("New version, " + info.NewVersion + " available from " + info.VersionDate + Environment.NewLine + "Would you like to update?", "Update Available", MessageBoxButton.YesNo, MessageBoxImage.Information);
                if (result == MessageBoxResult.Yes)
                {
                    UpdateButton.Content = "Downloading...";
                    updater = new ProgramUpdater();
                    updater.DownloadProgressUpdated += Updater_DownloadProgressUpdated;
                    updater.DownloadCompleted       += Updater_DownloadCompleted;
                    updater.Update();
                }
            }
        }
Exemple #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            YTDLUpdater updater = new YTDLUpdater();

            updater.UpdatingDownloader += Updater_UpdatingDownloader;
            updater.UpdateYTDL();
            if (ProgramConfigReader.GetCurrentConfigData().IsAutoCheckUpdate)
            {
                VersionInfo info = ProgramConfigReader.GetLatestVersion();
                if ((info.NewVersion != "NOT AVAILABLE") && (info.NewVersion != ProgramConfigReader.GetCurrentConfigData().CurrentVersion))
                {
                    MessageBoxResult result = MessageBox.Show("New version available, " + info.NewVersion + " from " + info.VersionDate + Environment.NewLine + "Would you like to update?", "Update Available", MessageBoxButton.YesNo, MessageBoxImage.Information);
                    if (result == MessageBoxResult.Yes)
                    {
                        Mainframe.Navigate(new Uri("OptionsPage.xaml", UriKind.Relative));
                        return;
                    }
                }
            }
            Mainframe.Navigate(new Uri("DownloadPage.xaml", UriKind.Relative));
        }