예제 #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());
 }