private async Task CheckForUpdates() { try { using (var wc = new WebClient() { CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore) }) { var latestVersion = double.Parse(await wc.DownloadStringTaskAsync("https://raw.githubusercontent.com/shaked6540/YoutubePlaylistDownloader/master/YoutubePlaylistDownloader/latestVersion.txt")); if (latestVersion > GlobalConsts.VERSION) { var changelog = await wc.DownloadStringTaskAsync("https://raw.githubusercontent.com/shaked6540/YoutubePlaylistDownloader/master/YoutubePlaylistDownloader/changelog.txt"); var dialogSettings = new MetroDialogSettings() { AffirmativeButtonText = $"{FindResource("UpdateNow")}", NegativeButtonText = $"{FindResource("No")}", FirstAuxiliaryButtonText = $"{FindResource("UpdateWhenIExit")}", ColorScheme = MetroDialogColorScheme.Theme, DefaultButtonFocus = MessageDialogResult.Affirmative, }; var update = await this.ShowMessageAsync($"{FindResource("NewVersionAvailable")}", $"{FindResource("DoYouWantToUpdate")}\n{changelog}", MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary, dialogSettings); if (update == MessageDialogResult.Affirmative) { GlobalConsts.LoadPage(new DownloadUpdate(latestVersion, changelog)); } else if (update == MessageDialogResult.FirstAuxiliary) { GlobalConsts.UpdateControl = new DownloadUpdate(latestVersion, changelog, true).UpdateLaterStillDownloading(); } } } } catch (Exception ex) { await GlobalConsts.Log(ex.ToString(), "Skeleton CheckForUpdates"); } }
private void Exit_Click(object sender, RoutedEventArgs e) { GlobalConsts.SaveConsts(); GlobalConsts.LoadPage(GlobalConsts.MainPage.Load()); }
private void SubscriptionsButton_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(new SubscriptionsPage()); }
private void Help_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(new Help()); }
private void Home_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(GlobalConsts.MainPage.Load()); }
private void About_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(new About()); }
private void Settings_Click(object sender, RoutedEventArgs e) { GlobalConsts.LoadPage(new Settings()); }