diff --git a/FoxTube.Background/BackgroundProcessor.cs b/FoxTube.Background/BackgroundProcessor.cs
index 774aeee..4e975c5 100644
--- a/FoxTube.Background/BackgroundProcessor.cs
+++ b/FoxTube.Background/BackgroundProcessor.cs
@@ -16,7 +16,7 @@ namespace FoxTube.Background
{
public sealed class BackgroundProcessor : IBackgroundTask
{
- private DateTime lastCheck = DateTime.Now;
+ private DateTime lastCheck;
private readonly ApplicationDataContainer settings = ApplicationData.Current.RoamingSettings;
dynamic prefs;
private readonly YouTubeService Service = new YouTubeService(new BaseClientService.Initializer()
diff --git a/FoxTube/Classes/Methods.cs b/FoxTube/Classes/Methods.cs
index fb37d62..97815e8 100644
--- a/FoxTube/Classes/Methods.cs
+++ b/FoxTube/Classes/Methods.cs
@@ -13,6 +13,7 @@ using System.Xml;
using Windows.ApplicationModel.Core;
using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.Resources;
+using Windows.ApplicationModel.Resources.Core;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.System;
diff --git a/FoxTube/Controls/ChannelCard.xaml b/FoxTube/Controls/ChannelCard.xaml
index 357b1b7..a203ddd 100644
--- a/FoxTube/Controls/ChannelCard.xaml
+++ b/FoxTube/Controls/ChannelCard.xaml
@@ -17,7 +17,7 @@
diff --git a/FoxTube/Pages/VideoGrid.xaml.cs b/FoxTube/Pages/VideoGrid.xaml.cs
index 099bfd7..ce00cf3 100644
--- a/FoxTube/Pages/VideoGrid.xaml.cs
+++ b/FoxTube/Pages/VideoGrid.xaml.cs
@@ -12,6 +12,7 @@ namespace FoxTube.Pages
public sealed partial class VideoGrid : Page
{
public int Count => list.Items.Count;
+ public ItemCollection Children => list.Items;
public VideoGrid()
{
diff --git a/FoxTube/Pages/VideoPage.xaml b/FoxTube/Pages/VideoPage.xaml
index b185e69..2a8e33c 100644
--- a/FoxTube/Pages/VideoPage.xaml
+++ b/FoxTube/Pages/VideoPage.xaml
@@ -32,35 +32,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -160,28 +160,19 @@
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
+
+
+
diff --git a/FoxTube/Pages/VideoPage.xaml.cs b/FoxTube/Pages/VideoPage.xaml.cs
index 2b3b9b9..d3152ed 100644
--- a/FoxTube/Pages/VideoPage.xaml.cs
+++ b/FoxTube/Pages/VideoPage.xaml.cs
@@ -1,5 +1,4 @@
using FoxTube.Controls;
-using FoxTube.Controls.Adverts;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using Microsoft.AppCenter.Analytics;
@@ -8,6 +7,8 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.Resources;
using Windows.Foundation;
@@ -52,6 +53,7 @@ namespace FoxTube.Pages
public Video item;
bool isExtended = false;
+ bool playlistLoaded = false;
Rating userRating = Rating.None;
@@ -146,17 +148,19 @@ namespace FoxTube.Pages
void SetSchedule()
{
+ views.Visibility = Visibility.Collapsed;
+ upcoming.Visibility = Visibility.Visible;
if (item.LiveStreamingDetails.ScheduledEndTime.HasValue || item.LiveStreamingDetails.ScheduledStartTime.HasValue)
schedule.Visibility = Visibility.Visible;
if (item.LiveStreamingDetails.ScheduledEndTime.HasValue)
{
- end.Text = $"{resources.GetString("/VideoPage/end")} {item.LiveStreamingDetails.ActualEndTime.Value}";
+ end.Text = $"{resources.GetString("/VideoPage/end")} {item.LiveStreamingDetails.ScheduledEndTime.Value}";
end.Visibility = Visibility.Visible;
}
if (item.LiveStreamingDetails.ScheduledStartTime.HasValue)
{
- start.Text = $"{resources.GetString("/VideoPage/start")} {item.LiveStreamingDetails.ActualStartTime.Value}";
+ start.Text = $"{resources.GetString("/VideoPage/start")} {item.LiveStreamingDetails.ScheduledStartTime.Value}";
start.Visibility = Visibility.Visible;
countdownPanel.Visibility = Visibility.Visible;
@@ -164,7 +168,7 @@ namespace FoxTube.Pages
countdownTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
countdownTimer.Tick += (s, e) =>
{
- countdown.Text = (item.LiveStreamingDetails.ScheduledStartTime.Value - DateTime.Now).ToString(@"hh\:mm\:ss");
+ countdown.Text = item.LiveStreamingDetails.ScheduledStartTime.Value > DateTime.Now ? "" : "-" + (item.LiveStreamingDetails.ScheduledStartTime.Value - DateTime.Now).ToString(@"hh\:mm\:ss");
if (countdown.Text == "00:00:00")
refresh_Click(this, null);
};
@@ -186,30 +190,19 @@ namespace FoxTube.Pages
PlaylistItemsResource.ListRequest listRequest = SecretsVault.Service.PlaylistItems.List("snippet");
listRequest.MaxResults = 50;
listRequest.PlaylistId = id;
- PlaylistItemListResponse listResponse = await listRequest.ExecuteAsync();
- foreach (PlaylistItem i in listResponse.Items)
+ PlaylistItemListResponse listResponse;
+ do
{
- items.Add(new VideoPlaylistItem(i.Snippet.Thumbnails.Medium.Url, i.Snippet.Title, i.Snippet.ResourceId.VideoId));
- if (items.Last().Id == videoId)
- selection = items.Last();
- }
-
- string token = listResponse.NextPageToken;
- while (!string.IsNullOrWhiteSpace(token))
- {
- listRequest.PageToken = token;
listResponse = await listRequest.ExecuteAsync();
+ listRequest.PageToken = listResponse.NextPageToken;
- foreach (PlaylistItem i in listResponse.Items)
- {
+ foreach(PlaylistItem i in listResponse.Items)
items.Add(new VideoPlaylistItem(i.Snippet.Thumbnails.Medium.Url, i.Snippet.Title, i.Snippet.ResourceId.VideoId));
- if (items.Last().Id == videoId)
- selection = items.Last();
- }
-
- token = listResponse.NextPageToken;
}
+ while (!string.IsNullOrWhiteSpace(listRequest.PageToken));
+
+ selection = items.Find(i => i.Id == item.Id);
for (int k = 0; k < items.Count; k++)
items[k].Number = k + 1;
@@ -224,6 +217,10 @@ namespace FoxTube.Pages
playlistList.SelectedItem = selection;
pivot.SelectedItem = playlist;
+ await Task.Delay(500);
+
+ playlistScroll.ChangeView(null, playlistList.SelectedIndex * 86 + 89, null, true);
+
if (playlistList.SelectedIndex == playlistList.Items.Count - 1)
player.Controls.IsNextTrackButtonVisible = false;
}
@@ -239,7 +236,7 @@ namespace FoxTube.Pages
channelRequest.Id = item.Snippet.ChannelId;
var item1 = (await channelRequest.ExecuteAsync()).Items[0];
- channelAvatar.ProfilePicture = new BitmapImage(new Uri(item1.Snippet.Thumbnails.Medium.Url));
+ channelAvatar.ProfilePicture = new BitmapImage(item1.Snippet.Thumbnails.Medium.Url.ToUri()) { DecodePixelHeight = 90, DecodePixelWidth = 90 };
channelName.Text = item.Snippet.ChannelTitle;
subscribers.Text = $"{item1.Statistics.SubscriberCount:0,0} {resources.GetString("/Cards/subscribers")}";