private void Page_Loaded(object sender, RoutedEventArgs e) { if (!ProgramConfigReader.VerifyConfigExists() || !ProgramConfigReader.VerifyRunProgramExists()) { MessageBox.Show("Config file cannot be loaded!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { ConfigData data = ProgramConfigReader.GetCurrentConfigData(); SavePath = data.DownloadLocation; CurrentVersion = data.CurrentVersion; MP3Thumbnail = data.IsUsingThumbnail; AutoUpdate = data.IsAutoCheckUpdate; UsingCmdAfterDwnld = data.IsUsingProgAfterDownload; CmdText = data.ProgAfterDownloadText; } VersionText.Content = "Current Version: " + CurrentVersion; UpdateCheckBox.IsChecked = AutoUpdate; if (SavePath == "Default") { DownloadLocationString.Content = "My Documents"; } else { DownloadLocationString.Content = SavePath; } MP3Checkbox.IsChecked = MP3Thumbnail; ProgramCheckbox.IsChecked = UsingCmdAfterDwnld; ProgramContent.Text = CmdText; }
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(); } } }
private void Page_Loaded(object sender, RoutedEventArgs e) { downloader.DownloadCompleted += Downloader_DownloadCompleted; downloader.DownloadProgressChanged += Downloader_DownloadProgressChanged; if (!ProgramConfigReader.VerifyConfigExists() || !ProgramConfigReader.VerifyRunProgramExists()) { MessageBox.Show("Config file cannot be loaded!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } else { Cfgdata = ProgramConfigReader.GetCurrentConfigData(); if (Cfgdata.DownloadLocation == "Default") { IsDefaultSaveLoc = true; } else { IsDefaultSaveLoc = false; } SaveLoc = Cfgdata.DownloadLocation; if (Cfgdata.IsUsingThumbnail) { IsUsingMP3Thumbnail = true; } else { IsUsingMP3Thumbnail = false; } } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { ConfigData data = new ConfigData(); data.CurrentVersion = CurrentVersion; data.DownloadLocation = SavePath; data.IsAutoCheckUpdate = AutoUpdate; data.IsUsingProgAfterDownload = UsingCmdAfterDwnld; data.IsUsingThumbnail = MP3Thumbnail; data.ProgAfterDownloadText = CmdText; ProgramConfigReader.WriteConfigData(data); MessageBox.Show("Successfully saved", "Options", MessageBoxButton.OK, MessageBoxImage.Information); }
private void Page_Loaded(object sender, RoutedEventArgs e) { StatusText.Content = ""; DownloadStatus.Content = ""; VidTitle.Content = ""; VidQualityBox.IsEnabled = false; AudioQualityBox.IsEnabled = false; firstMetadata = true; FileSizeLabel.Content = ""; if (!ProgramConfigReader.VerifyConfigExists() || !ProgramConfigReader.VerifyRunProgramExists()) { MessageBox.Show("Config file cannot be loaded!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { ConfigData data = ProgramConfigReader.GetCurrentConfigData(); currentVersion = data.CurrentVersion; SaveLoc = data.DownloadLocation; AutoUpdate = data.IsAutoCheckUpdate; UsePostDownloadCmd = data.IsUsingProgAfterDownload; usingMP3Thumbnail = data.IsUsingThumbnail; CmdText = data.ProgAfterDownloadText; if (SaveLoc == "Default") { isDefaultSaveLoc = true; } else { isDefaultSaveLoc = false; } } /* if (AutoUpdate) * { * VersionInfo info = ProgramConfigReader.GetLatestVersion(); * if((info.NewVersion!="NOT AVAILABLE") && (info.NewVersion != 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) * { * this.NavigationService.Navigate(new Uri("OptionsPage.xaml", UriKind.Relative)); * } * } * }*/ }
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)); }