コード例 #1
0
        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");
            }
        }
コード例 #2
0
 private void Exit_Click(object sender, RoutedEventArgs e)
 {
     GlobalConsts.SaveConsts();
     GlobalConsts.LoadPage(GlobalConsts.MainPage.Load());
 }
コード例 #3
0
 private void SubscriptionsButton_Click(object sender, RoutedEventArgs e)
 {
     GlobalConsts.LoadPage(new SubscriptionsPage());
 }
コード例 #4
0
 private void Help_Click(object sender, RoutedEventArgs e)
 {
     GlobalConsts.LoadPage(new Help());
 }
コード例 #5
0
 private void Home_Click(object sender, RoutedEventArgs e)
 {
     GlobalConsts.LoadPage(GlobalConsts.MainPage.Load());
 }
コード例 #6
0
 private void About_Click(object sender, RoutedEventArgs e)
 {
     GlobalConsts.LoadPage(new About());
 }
コード例 #7
0
 private void Settings_Click(object sender, RoutedEventArgs e)
 {
     GlobalConsts.LoadPage(new Settings());
 }