@@ -16,7 +16,7 @@ namespace FoxTube.Background
|
|||||||
{
|
{
|
||||||
public sealed class BackgroundProcessor : IBackgroundTask
|
public sealed class BackgroundProcessor : IBackgroundTask
|
||||||
{
|
{
|
||||||
private DateTime lastCheck = DateTime.Now;
|
private DateTime lastCheck;
|
||||||
private readonly ApplicationDataContainer settings = ApplicationData.Current.RoamingSettings;
|
private readonly ApplicationDataContainer settings = ApplicationData.Current.RoamingSettings;
|
||||||
dynamic prefs;
|
dynamic prefs;
|
||||||
private readonly YouTubeService Service = new YouTubeService(new BaseClientService.Initializer()
|
private readonly YouTubeService Service = new YouTubeService(new BaseClientService.Initializer()
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using System.Xml;
|
|||||||
using Windows.ApplicationModel.Core;
|
using Windows.ApplicationModel.Core;
|
||||||
using Windows.ApplicationModel.DataTransfer;
|
using Windows.ApplicationModel.DataTransfer;
|
||||||
using Windows.ApplicationModel.Resources;
|
using Windows.ApplicationModel.Resources;
|
||||||
|
using Windows.ApplicationModel.Resources.Core;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
using Windows.Storage.Streams;
|
using Windows.Storage.Streams;
|
||||||
using Windows.System;
|
using Windows.System;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</Windows10version1809:UserControl.OpacityTransition>
|
</Windows10version1809:UserControl.OpacityTransition>
|
||||||
|
|
||||||
<Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click">
|
<Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click">
|
||||||
<Grid>
|
<Grid Name="grid">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
|
|||||||
@@ -30,41 +30,57 @@ namespace FoxTube.Controls
|
|||||||
|
|
||||||
public async void Initialize(string id, string live)
|
public async void Initialize(string id, string live)
|
||||||
{
|
{
|
||||||
ChannelsResource.ListRequest request = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
|
|
||||||
request.Id = id;
|
|
||||||
ChannelListResponse response = await request.ExecuteAsync();
|
|
||||||
|
|
||||||
item = response.Items[0];
|
|
||||||
channelId = id;
|
|
||||||
|
|
||||||
title.Text = item.Snippet.Title;
|
|
||||||
description.Text = item.Snippet.Description;
|
|
||||||
|
|
||||||
subs.Text = $"{item.Statistics.SubscriberCount:0,0} {resources.GetString("/Cards/subscribers")}";
|
|
||||||
uploads.Text = $"{item.Statistics.VideoCount:0,0} {resources.GetString("/Cards/videos")}";
|
|
||||||
|
|
||||||
if (live == "live")
|
|
||||||
liveTag.Visibility = Visibility.Visible;
|
|
||||||
|
|
||||||
if(SecretsVault.IsAuthorized)
|
|
||||||
{
|
|
||||||
if(SecretsVault.Subscriptions.Exists(i => i.Snippet.ResourceId.ChannelId == id))
|
|
||||||
{
|
|
||||||
subscribe.Background = new SolidColorBrush(Colors.Transparent);
|
|
||||||
subscribe.Foreground = new SolidColorBrush(Colors.Gray);
|
|
||||||
subscribe.Content = resources.GetString("/Cards/unsubscribe");
|
|
||||||
}
|
|
||||||
subscriptionPane.Visibility = Visibility.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
try { avatar.ProfilePicture = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url)); }
|
|
||||||
catch { }
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!item.BrandingSettings.Image.BannerImageUrl.Contains("default"))
|
if (id == SecretsVault.AccountId)
|
||||||
cover.Source = new BitmapImage(item.BrandingSettings.Image.BannerImageUrl.ToUri());
|
grid.RowDefinitions[3].Height = new GridLength(0);
|
||||||
|
|
||||||
|
ChannelsResource.ListRequest request = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
|
||||||
|
request.Id = id;
|
||||||
|
ChannelListResponse response = await request.ExecuteAsync();
|
||||||
|
|
||||||
|
item = response.Items[0];
|
||||||
|
channelId = id;
|
||||||
|
|
||||||
|
title.Text = item.Snippet.Title;
|
||||||
|
description.Text = item.Snippet.Description;
|
||||||
|
|
||||||
|
subs.Text = $"{item.Statistics.SubscriberCount:0,0} {resources.GetString("/Cards/subscribers")}";
|
||||||
|
uploads.Text = $"{item.Statistics.VideoCount:0,0} {resources.GetString("/Cards/videos")}";
|
||||||
|
|
||||||
|
if (live == "live")
|
||||||
|
liveTag.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
if (SecretsVault.IsAuthorized)
|
||||||
|
{
|
||||||
|
if (SecretsVault.Subscriptions.Exists(i => i.Snippet.ResourceId.ChannelId == id))
|
||||||
|
{
|
||||||
|
subscribe.Background = new SolidColorBrush(Colors.Transparent);
|
||||||
|
subscribe.Foreground = new SolidColorBrush(Colors.Gray);
|
||||||
|
subscribe.Content = resources.GetString("/Cards/unsubscribe");
|
||||||
|
}
|
||||||
|
subscriptionPane.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
try { avatar.ProfilePicture = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url)) { DecodePixelWidth = 74, DecodePixelHeight = 74 }; }
|
||||||
|
catch { }
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!item.BrandingSettings.Image.BannerImageUrl.Contains("default"))
|
||||||
|
cover.Source = new BitmapImage(item.BrandingSettings.Image.BannerImageUrl.ToUri());
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Visibility = Visibility.Collapsed;
|
||||||
|
Microsoft.AppCenter.Analytics.Analytics.TrackEvent("VideoCard loading failed", new System.Collections.Generic.Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "Exception", e.GetType().ToString() },
|
||||||
|
{ "Message", e.Message },
|
||||||
|
{ "Video ID", id }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch { }
|
|
||||||
|
|
||||||
Opacity = 1;
|
Opacity = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,11 @@
|
|||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="5,0">
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="5,0">
|
||||||
<PersonPicture Height="20" ProfilePicture="{Binding Path=Avatar}"/>
|
<PersonPicture Height="20">
|
||||||
|
<PersonPicture.ProfilePicture>
|
||||||
|
<BitmapImage UriSource="{Binding Path=Avatar}" DecodePixelHeight="20" DecodePixelWidth="20"/>
|
||||||
|
</PersonPicture.ProfilePicture>
|
||||||
|
</PersonPicture>
|
||||||
<FontIcon Glyph="" Margin="2,0" Visibility="{Binding Path=IsVerified}">
|
<FontIcon Glyph="" Margin="2,0" Visibility="{Binding Path=IsVerified}">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<TextBlock x:Uid="/Chat/verified"/>
|
<TextBlock x:Uid="/Chat/verified"/>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace FoxTube.Controls
|
|||||||
meta.Text = string.Format("{0} {1}", Methods.GetAgo(comment.Snippet.TopLevelComment.Snippet.PublishedAt.Value), comment.Snippet.TopLevelComment.Snippet.UpdatedAt != comment.Snippet.TopLevelComment.Snippet.PublishedAt ? resources.GetString("/CommentsPage/edited") : "");
|
meta.Text = string.Format("{0} {1}", Methods.GetAgo(comment.Snippet.TopLevelComment.Snippet.PublishedAt.Value), comment.Snippet.TopLevelComment.Snippet.UpdatedAt != comment.Snippet.TopLevelComment.Snippet.PublishedAt ? resources.GetString("/CommentsPage/edited") : "");
|
||||||
Methods.FormatText(ref text, comment.Snippet.TopLevelComment.Snippet.TextDisplay);
|
Methods.FormatText(ref text, comment.Snippet.TopLevelComment.Snippet.TextDisplay);
|
||||||
|
|
||||||
try { avatar.ProfilePicture = new BitmapImage(new Uri(comment.Snippet.TopLevelComment.Snippet.AuthorProfileImageUrl)); }
|
try { avatar.ProfilePicture = new BitmapImage(new Uri(comment.Snippet.TopLevelComment.Snippet.AuthorProfileImageUrl)) { DecodePixelWidth = 50, DecodePixelHeight = 50 }; }
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ namespace FoxTube.Controls
|
|||||||
meta.Text = string.Format("{0} {1}", Methods.GetAgo(comment.Snippet.PublishedAt.Value), comment.Snippet.UpdatedAt != comment.Snippet.PublishedAt ? resources.GetString("/CommentsPage/edited") : "");
|
meta.Text = string.Format("{0} {1}", Methods.GetAgo(comment.Snippet.PublishedAt.Value), comment.Snippet.UpdatedAt != comment.Snippet.PublishedAt ? resources.GetString("/CommentsPage/edited") : "");
|
||||||
Methods.FormatText(ref text, comment.Snippet.TextDisplay);
|
Methods.FormatText(ref text, comment.Snippet.TextDisplay);
|
||||||
|
|
||||||
try { avatar.ProfilePicture = new BitmapImage(new Uri(comment.Snippet.AuthorProfileImageUrl)); }
|
try { avatar.ProfilePicture = new BitmapImage(new Uri(comment.Snippet.AuthorProfileImageUrl)) { DecodePixelWidth = 50, DecodePixelHeight = 50 }; }
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ namespace FoxTube.Controls
|
|||||||
|
|
||||||
void SetMeta()
|
void SetMeta()
|
||||||
{
|
{
|
||||||
thumbnail.Source = new BitmapImage(Container.Thumbnail);
|
thumbnail.Source = new BitmapImage(Container.Thumbnail) { DecodePixelHeight = (int)thumbnail.ActualHeight, DecodePixelWidth = (int)thumbnail.ActualWidth };
|
||||||
|
|
||||||
title.Text = Container.Title;
|
title.Text = Container.Title;
|
||||||
path.Text = File.Path;
|
path.Text = File.Path;
|
||||||
|
|||||||
@@ -184,20 +184,17 @@ namespace FoxTube
|
|||||||
|
|
||||||
private void VideoSource_CurrentStateChanged(object sender, RoutedEventArgs e)
|
private void VideoSource_CurrentStateChanged(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (audioSource.Source == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch(videoSource.CurrentState)
|
switch(videoSource.CurrentState)
|
||||||
{
|
{
|
||||||
case Windows.UI.Xaml.Media.MediaElementState.Buffering:
|
case Windows.UI.Xaml.Media.MediaElementState.Buffering:
|
||||||
case Windows.UI.Xaml.Media.MediaElementState.Paused:
|
case Windows.UI.Xaml.Media.MediaElementState.Paused:
|
||||||
systemControls.PlaybackStatus = MediaPlaybackStatus.Paused;
|
systemControls.PlaybackStatus = MediaPlaybackStatus.Paused;
|
||||||
// TODO: Create history entry
|
// TODO: Create history entry
|
||||||
audioSource.Pause();
|
audioSource?.Pause();
|
||||||
break;
|
break;
|
||||||
case Windows.UI.Xaml.Media.MediaElementState.Playing:
|
case Windows.UI.Xaml.Media.MediaElementState.Playing:
|
||||||
systemControls.PlaybackStatus = MediaPlaybackStatus.Playing;
|
systemControls.PlaybackStatus = MediaPlaybackStatus.Playing;
|
||||||
audioSource.Play();
|
audioSource?.Play();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace FoxTube.Controls
|
|||||||
|
|
||||||
try { thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); }
|
try { thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); }
|
||||||
catch { }
|
catch { }
|
||||||
try { avatar.ProfilePicture = new BitmapImage(new Uri((await r.ExecuteAsync()).Items[0].Snippet.Thumbnails.Medium.Url)); }
|
try { avatar.ProfilePicture = new BitmapImage(new Uri((await r.ExecuteAsync()).Items[0].Snippet.Thumbnails.Medium.Url)) { DecodePixelWidth = 46, DecodePixelHeight = 46 }; }
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
Opacity = 1;
|
Opacity = 1;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace FoxTube.Controls
|
|||||||
liveTag.Visibility = Visibility.Visible;
|
liveTag.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
if (item.LiveStreamingDetails.ScheduledStartTime.HasValue)
|
if (item.LiveStreamingDetails.ScheduledStartTime.HasValue)
|
||||||
liveContent.Text = $"{resources.GetString("/Cards/goesLive")} {(item.LiveStreamingDetails.ScheduledStartTime.Value - DateTime.Now).ToString(@"hh\:mm\:ss")}";
|
liveContent.Text = resources.GetString("/Cards/goesLive") + (item.LiveStreamingDetails.ScheduledStartTime.Value > DateTime.Now ? " " : " -") + (item.LiveStreamingDetails.ScheduledStartTime.Value - DateTime.Now).ToString(@"hh\:mm\:ss");
|
||||||
else liveContent.Text = resources.GetString("/Cards/upcoming");
|
else liveContent.Text = resources.GetString("/Cards/upcoming");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -83,7 +83,7 @@ namespace FoxTube.Controls
|
|||||||
|
|
||||||
try { thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); }
|
try { thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); }
|
||||||
catch { }
|
catch { }
|
||||||
try { avatar.ProfilePicture = new BitmapImage((await new YoutubeClient().GetChannelAsync(item.Snippet.ChannelId)).LogoUrl.ToUri()); }
|
try { avatar.ProfilePicture = new BitmapImage((await new YoutubeClient().GetChannelAsync(item.Snippet.ChannelId)).LogoUrl.ToUri()) { DecodePixelWidth = 46, DecodePixelHeight = 46 }; }
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
if(SecretsVault.History.Contains(videoId))
|
if(SecretsVault.History.Contains(videoId))
|
||||||
|
|||||||
@@ -56,6 +56,12 @@ namespace FoxTube.Pages
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (id == SecretsVault.AccountId)
|
||||||
|
{
|
||||||
|
infoPanel.ColumnDefinitions[2].Width = new GridLength(0);
|
||||||
|
collapsedBtn.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
ChannelsResource.ListRequest infoRequest = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
|
ChannelsResource.ListRequest infoRequest = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
|
||||||
infoRequest.Id = channelId = id;
|
infoRequest.Id = channelId = id;
|
||||||
|
|
||||||
@@ -66,10 +72,10 @@ namespace FoxTube.Pages
|
|||||||
videosCount.Text = $"{item.Statistics.VideoCount:0,0} {resources.GetString("/Cards/videos")}";
|
videosCount.Text = $"{item.Statistics.VideoCount:0,0} {resources.GetString("/Cards/videos")}";
|
||||||
|
|
||||||
if (!item.BrandingSettings.Image.BannerImageUrl.Contains("default"))
|
if (!item.BrandingSettings.Image.BannerImageUrl.Contains("default"))
|
||||||
try { channelCover.Source = new BitmapImage(new Uri(item.BrandingSettings.Image.BannerImageUrl)); }
|
try { channelCover.Source = new BitmapImage(item.BrandingSettings.Image.BannerImageUrl.ToUri()); }
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
try { avatar.ProfilePicture = collapsedAvatar.ProfilePicture = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url)); }
|
try { avatar.ProfilePicture = collapsedAvatar.ProfilePicture = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()) { DecodePixelHeight = 100, DecodePixelWidth = 100 }; }
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
Methods.FormatText(ref description, item.Snippet.Description);
|
Methods.FormatText(ref description, item.Snippet.Description);
|
||||||
|
|||||||
@@ -12,13 +12,24 @@
|
|||||||
<Windows10version1809:Grid.BackgroundTransition>
|
<Windows10version1809:Grid.BackgroundTransition>
|
||||||
<BrushTransition/>
|
<BrushTransition/>
|
||||||
</Windows10version1809:Grid.BackgroundTransition>
|
</Windows10version1809:Grid.BackgroundTransition>
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup>
|
||||||
|
<VisualState>
|
||||||
|
<VisualState.StateTriggers>
|
||||||
|
<AdaptiveTrigger MinWindowWidth="{x:Bind nav.CompactModeThresholdWidth}"/>
|
||||||
|
</VisualState.StateTriggers>
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="Title.Margin" Value="0"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
|
||||||
<Border x:Name="AppTitleBar"
|
<Border x:Name="AppTitleBar"
|
||||||
IsHitTestVisible="True"
|
IsHitTestVisible="True"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Canvas.ZIndex="1"
|
Canvas.ZIndex="1">
|
||||||
Margin="12, 8">
|
|
||||||
|
|
||||||
<TextBlock x:Name="AppTitle"
|
<TextBlock x:Name="AppTitle"
|
||||||
Text="FoxTube"
|
Text="FoxTube"
|
||||||
@@ -26,12 +37,20 @@
|
|||||||
Style="{StaticResource CaptionTextBlockStyle}" />
|
Style="{StaticResource CaptionTextBlockStyle}" />
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<NavigationView SelectedItem="toHome" Windows10version1803:BackRequested="Nav_BackRequested" Windows10version1803:PaneClosing="Nav_PaneChanged" Windows10version1803:PaneOpening="Nav_PaneChanged" Windows10version1803:PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" SelectionChanged="Nav_SelectionChanged">
|
<NavigationView SelectedItem="toHome" Windows10version1803:BackRequested="Nav_BackRequested" Windows10version1803:PaneClosing="Nav_PaneClosing" Windows10version1803:PaneOpened="Nav_PaneOpened" OpenPaneLength="300" Name="nav" SelectionChanged="Nav_SelectionChanged">
|
||||||
|
|
||||||
|
<NavigationView.Header>
|
||||||
|
<TextBlock Name="Title" Text="Hello, World!" Margin="0,30,0,10" Style="{StaticResource TitleTextBlockStyle}"/>
|
||||||
|
</NavigationView.Header>
|
||||||
|
|
||||||
<NavigationView.MenuItemTemplate>
|
<NavigationView.MenuItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal" Padding="5" Margin="-5,0,0,0" Tag="{Binding Snippet.ResourceId.ChannelId}">
|
<StackPanel Orientation="Horizontal" Padding="5" Margin="-5,0,0,0" Tag="{Binding Snippet.ResourceId.ChannelId}">
|
||||||
<PersonPicture Height="20" ProfilePicture="{Binding Snippet.Thumbnails.Medium.Url}" Margin="-5,0,15,0"/>
|
<PersonPicture Height="20" Margin="-5,0,15,0">
|
||||||
|
<PersonPicture.ProfilePicture>
|
||||||
|
<BitmapImage UriSource="{Binding Snippet.Thumbnails.Medium.Url}" DecodePixelHeight="20" DecodePixelWidth="20"/>
|
||||||
|
</PersonPicture.ProfilePicture>
|
||||||
|
</PersonPicture>
|
||||||
<TextBlock Text="{Binding Snippet.Title}"/>
|
<TextBlock Text="{Binding Snippet.Title}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ namespace FoxTube
|
|||||||
public MainPage()
|
public MainPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
SetTitleBar();
|
Window.Current.SetTitleBar(AppTitleBar);
|
||||||
|
CoreApplication.GetCurrentView().TitleBar.LayoutMetricsChanged += (s, e) => SetTitleBar(s);
|
||||||
|
|
||||||
SecretsVault.AuthorizationStateChanged += AuthorizationStateChanged;
|
SecretsVault.AuthorizationStateChanged += AuthorizationStateChanged;
|
||||||
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
|
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
|
||||||
@@ -47,20 +48,20 @@ namespace FoxTube
|
|||||||
|
|
||||||
headers = new Dictionary<Type, Action>()
|
headers = new Dictionary<Type, Action>()
|
||||||
{
|
{
|
||||||
{ typeof(Settings), () => nav.Header = resources.GetString("/Main/settings/Content") },
|
{ typeof(Settings), () => Title.Text = resources.GetString("/Main/settings/Content") },
|
||||||
{ typeof(ChannelPage), () => nav.Header = resources.GetString("/Main/channel") },
|
{ typeof(ChannelPage), () => Title.Text = resources.GetString("/Main/channel") },
|
||||||
{ typeof(PlaylistPage), () => nav.Header = resources.GetString("/Main/playlist") },
|
{ typeof(PlaylistPage), () => Title.Text = resources.GetString("/Main/playlist") },
|
||||||
{ typeof(Search), () => nav.Header = resources.GetString("/Main/searchPlaceholder/PlaceholderText") },
|
{ typeof(Search), () => Title.Text = resources.GetString("/Main/searchPlaceholder/PlaceholderText") },
|
||||||
{ typeof(Subscriptions), () => nav.Header = resources.GetString("/Main/subscriptions/Content") },
|
{ typeof(Subscriptions), () => Title.Text = resources.GetString("/Main/subscriptions/Content") },
|
||||||
{ typeof(History), () =>
|
{ typeof(History), () =>
|
||||||
{
|
{
|
||||||
if((content.Content as History).id == "HL")
|
if((content.Content as History).id == "HL")
|
||||||
nav.Header = resources.GetString("/Main/history/Content");
|
Title.Text = resources.GetString("/Main/history/Content");
|
||||||
else
|
else
|
||||||
nav.Header = resources.GetString("/Main/later/Content");
|
Title.Text = resources.GetString("/Main/later/Content");
|
||||||
} },
|
} },
|
||||||
{ typeof(Home), () => nav.Header = resources.GetString("/Main/home/Content") },
|
{ typeof(Home), () => Title.Text = resources.GetString("/Main/home/Content") },
|
||||||
{ typeof(Downloads), () => nav.Header = resources.GetString("/Main/downloads/Content") }
|
{ typeof(Downloads), () => Title.Text = resources.GetString("/Main/downloads/Content") }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,8 +71,16 @@ namespace FoxTube
|
|||||||
catch { return null; }
|
catch { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTitleBar()
|
public void SetTitleBar(CoreApplicationViewTitleBar coreTitleBar = null)
|
||||||
{
|
{
|
||||||
|
if(coreTitleBar != null)
|
||||||
|
{
|
||||||
|
bool full = ApplicationView.GetForCurrentView().IsFullScreenMode;
|
||||||
|
double left = 12 + (full ? 0 : coreTitleBar.SystemOverlayLeftInset);
|
||||||
|
AppTitle.Margin = new Thickness(left, 8, 0, 0);
|
||||||
|
AppTitleBar.Height = coreTitleBar.Height;
|
||||||
|
}
|
||||||
|
|
||||||
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
|
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
|
||||||
|
|
||||||
titleBar.ButtonBackgroundColor = Colors.Transparent;
|
titleBar.ButtonBackgroundColor = Colors.Transparent;
|
||||||
@@ -84,8 +93,6 @@ namespace FoxTube
|
|||||||
titleBar.ForegroundColor = Colors.White;
|
titleBar.ForegroundColor = Colors.White;
|
||||||
else
|
else
|
||||||
titleBar.ForegroundColor = Colors.Black;
|
titleBar.ForegroundColor = Colors.Black;
|
||||||
|
|
||||||
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SecretsVault_SubscriptionsChanged(object sender, params object[] args)
|
private void SecretsVault_SubscriptionsChanged(object sender, params object[] args)
|
||||||
@@ -145,6 +152,8 @@ namespace FoxTube
|
|||||||
for (int k = 0; k < SecretsVault.Subscriptions.Count && k < 10; k++)
|
for (int k = 0; k < SecretsVault.Subscriptions.Count && k < 10; k++)
|
||||||
nav.MenuItems.Add(SecretsVault.Subscriptions[k]);
|
nav.MenuItems.Add(SecretsVault.Subscriptions[k]);
|
||||||
}
|
}
|
||||||
|
if (SecretsVault.UserChannel == null)
|
||||||
|
toChannel.Visibility = Visibility.Collapsed;
|
||||||
break;
|
break;
|
||||||
case false:
|
case false:
|
||||||
for (int k = nav.MenuItems.Count - 1; k > 8; k--)
|
for (int k = nav.MenuItems.Count - 1; k > 8; k--)
|
||||||
@@ -363,7 +372,7 @@ namespace FoxTube
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
nav.IsBackEnabled = true;
|
nav.IsBackEnabled = true;
|
||||||
nav.Header = resources.GetString("/Main/video");
|
Title.Text = resources.GetString("/Main/video");
|
||||||
nav.ExpandedModeThresholdWidth = short.MaxValue;
|
nav.ExpandedModeThresholdWidth = short.MaxValue;
|
||||||
nav.IsPaneOpen = false;
|
nav.IsPaneOpen = false;
|
||||||
}
|
}
|
||||||
@@ -468,9 +477,9 @@ namespace FoxTube
|
|||||||
if(e.SourcePageType == typeof(History))
|
if(e.SourcePageType == typeof(History))
|
||||||
{
|
{
|
||||||
if(e.Parameter.ToString() == "HL")
|
if(e.Parameter.ToString() == "HL")
|
||||||
nav.Header = resources.GetString("/Main/history/Content");
|
Title.Text = resources.GetString("/Main/history/Content");
|
||||||
else if(e.Parameter.ToString() == "WL")
|
else if(e.Parameter.ToString() == "WL")
|
||||||
nav.Header = resources.GetString("/Main/later/Content");
|
Title.Text = resources.GetString("/Main/later/Content");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content.CanGoBack)
|
if (content.CanGoBack)
|
||||||
@@ -547,9 +556,19 @@ namespace FoxTube
|
|||||||
content.GoBack();
|
content.GoBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Nav_PaneChanged(NavigationView sender, object args)
|
private void Nav_PaneClosing(NavigationView sender, NavigationViewPaneClosingEventArgs args)
|
||||||
{
|
{
|
||||||
AppTitleBar.Visibility = nav.IsPaneOpen? Visibility.Visible : Visibility.Collapsed;
|
AppTitle.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Nav_PaneOpened(NavigationView sender, object args)
|
||||||
|
{
|
||||||
|
AppTitle.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
if (sender.DisplayMode == NavigationViewDisplayMode.Expanded && sender.IsPaneOpen)
|
||||||
|
AppTitleBar.Margin = new Thickness(40, 0, 0, 0);
|
||||||
|
else
|
||||||
|
AppTitleBar.Margin = new Thickness();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace FoxTube.Pages
|
|||||||
channelRequest.Id = item.Snippet.ChannelId;
|
channelRequest.Id = item.Snippet.ChannelId;
|
||||||
Channel channel = (await channelRequest.ExecuteAsync()).Items[0];
|
Channel channel = (await channelRequest.ExecuteAsync()).Items[0];
|
||||||
|
|
||||||
try { avatar.ProfilePicture = new BitmapImage(channel.Snippet.Thumbnails.Medium.Url.ToUri()); }
|
try { avatar.ProfilePicture = new BitmapImage(channel.Snippet.Thumbnails.Medium.Url.ToUri()) { DecodePixelWidth = 50, DecodePixelHeight = 50 }; }
|
||||||
catch { }
|
catch { }
|
||||||
try { thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); }
|
try { thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); }
|
||||||
catch { }
|
catch { }
|
||||||
|
|||||||
@@ -20,7 +20,11 @@
|
|||||||
<ColumnDefinition Width="55"/>
|
<ColumnDefinition Width="55"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<PersonPicture Height="50" HorizontalAlignment="Left" ProfilePicture="{Binding Path=Snippet.Thumbnails.Medium.Url}"/>
|
<PersonPicture Height="50" HorizontalAlignment="Left">
|
||||||
|
<PersonPicture.ProfilePicture>
|
||||||
|
<BitmapImage UriSource="{Binding Path=Snippet.Thumbnails.Medium.Url}" DecodePixelHeight="50" DecodePixelWidth="50"/>
|
||||||
|
</PersonPicture.ProfilePicture>
|
||||||
|
</PersonPicture>
|
||||||
<TextBlock Grid.Column="1" TextWrapping="Wrap" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" Text="{Binding Path=Snippet.Title}"/>
|
<TextBlock Grid.Column="1" TextWrapping="Wrap" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" Text="{Binding Path=Snippet.Title}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace FoxTube.Pages
|
|||||||
public sealed partial class VideoGrid : Page
|
public sealed partial class VideoGrid : Page
|
||||||
{
|
{
|
||||||
public int Count => list.Items.Count;
|
public int Count => list.Items.Count;
|
||||||
|
public ItemCollection Children => list.Items;
|
||||||
|
|
||||||
public VideoGrid()
|
public VideoGrid()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,35 +32,35 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ScrollViewer Margin="0,0,0,50" Name="mainScroll" VerticalScrollBarVisibility="Hidden">
|
<ScrollViewer Margin="0,0,0,50" Name="mainScroll" VerticalScrollBarVisibility="Hidden">
|
||||||
<StackPanel Orientation="Vertical" Name="mainContent">
|
<StackPanel Orientation="Vertical" Name="mainContent">
|
||||||
|
<Border BorderBrush="Red" BorderThickness="5" CornerRadius="10" Margin="0,10" Name="upcoming" Visibility="Collapsed">
|
||||||
|
<Grid Margin="10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<FontIcon Glyph="" FontSize="50" VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock x:Uid="/VideoPage/upcomingHeader" FontWeight="Bold" FontSize="25" Text="Stream hasn't started yet" Grid.Column="1" Margin="10,0" VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="2" Margin="10,0" Name="schedule" Visibility="Collapsed">
|
||||||
|
<TextBlock x:Uid="/VideoPage/scheduleHeader" FontSize="20" FontWeight="SemiBold" Text="Stream schedule:"/>
|
||||||
|
<TextBlock Name="start" Text="Starts at: 2/15/2019 21:00:00" Visibility="Collapsed"/>
|
||||||
|
<TextBlock Name="end" Text="Ends at: 2/15/2019 23:00:00" Visibility="Collapsed"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="3" Margin="10,0" Name="countdownPanel" Visibility="Collapsed">
|
||||||
|
<TextBlock x:Uid="/VideoPage/countdown" FontSize="20" FontWeight="SemiBold" Text="Stream starts in:"/>
|
||||||
|
<TextBlock Name="countdown" FontWeight="Bold" FontSize="35" Text="00:12:12"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
<local:VideoPlayer x:Name="player" NextClicked="Player_NextClicked" MiniMode="Player_Minimize"/>
|
<local:VideoPlayer x:Name="player" NextClicked="Player_NextClicked" MiniMode="Player_Minimize"/>
|
||||||
<PivotItem Header="Description" Name="descriptionPanel">
|
<PivotItem Header="Description" Name="descriptionPanel">
|
||||||
<StackPanel Margin="0,10">
|
<StackPanel Margin="0,10">
|
||||||
<TextBlock IsTextSelectionEnabled="True" Name="title" Text="[Video title]" FontSize="25" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Start"/>
|
<TextBlock IsTextSelectionEnabled="True" Name="title" Text="[Video title]" FontSize="25" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Start"/>
|
||||||
<Border BorderBrush="Red" BorderThickness="5" CornerRadius="10" Margin="0,10" Name="upcoming" Visibility="Collapsed">
|
|
||||||
<Grid Margin="10">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="auto"/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition Width="auto"/>
|
|
||||||
<ColumnDefinition Width="auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<FontIcon Glyph="" FontSize="50" VerticalAlignment="Center"/>
|
|
||||||
|
|
||||||
<TextBlock x:Uid="/VideoPage/upcomingHeader" FontWeight="Bold" FontSize="25" Text="Stream hasn't started yet" Grid.Column="1" Margin="10,0" VerticalAlignment="Center"/>
|
|
||||||
|
|
||||||
<StackPanel Grid.Column="2" Margin="10,0" Name="schedule" Visibility="Collapsed">
|
|
||||||
<TextBlock x:Uid="/VideoPage/scheduleHeader" FontSize="20" FontWeight="SemiBold" Text="Stream schedule:"/>
|
|
||||||
<TextBlock Name="start" Text="Starts at: 2/15/2019 21:00:00" Visibility="Collapsed"/>
|
|
||||||
<TextBlock Name="end" Text="Ends at: 2/15/2019 23:00:00" Visibility="Collapsed"/>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel Grid.Column="3" Margin="10,0" Name="countdownPanel" Visibility="Collapsed">
|
|
||||||
<TextBlock x:Uid="/VideoPage/countdown" FontSize="20" FontWeight="SemiBold" Text="Stream starts in:"/>
|
|
||||||
<TextBlock Name="countdown" FontWeight="Bold" FontSize="35" Text="00:12:12"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
@@ -160,28 +160,19 @@
|
|||||||
<Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False">
|
<Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False">
|
||||||
<PivotItem x:Uid="/VideoPage/related" Header="Suggestions">
|
<PivotItem x:Uid="/VideoPage/related" Header="Suggestions">
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel>
|
<pages:VideoGrid x:Name="relatedVideos"/>
|
||||||
<controls1:Advert/>
|
|
||||||
<StackPanel Name="relatedVideos">
|
|
||||||
<StackPanel.ChildrenTransitions>
|
|
||||||
<TransitionCollection>
|
|
||||||
<EntranceThemeTransition IsStaggeringEnabled="True"/>
|
|
||||||
</TransitionCollection>
|
|
||||||
</StackPanel.ChildrenTransitions>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
<PivotItem x:Uid="/VideoPage/comments" Header="Comments" Name="commentsPlaceholder">
|
<PivotItem x:Uid="/VideoPage/comments" Header="Comments" Name="commentsPlaceholder">
|
||||||
<pages:CommentsPage x:Name="comments"/>
|
<pages:CommentsPage x:Name="comments"/>
|
||||||
</PivotItem>
|
</PivotItem>
|
||||||
<PivotItem x:Uid="/VideoPage/playlist" Header="Playlist" Name="playlist">
|
<PivotItem x:Uid="/VideoPage/playlist" Header="Playlist" Name="playlist">
|
||||||
<ScrollViewer>
|
<ScrollViewer Name="playlistScroll">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel Padding="8" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}">
|
<StackPanel Padding="8" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}">
|
||||||
<TextBlock Text="Music" FontSize="26" TextWrapping="WrapWholeWords" Name="playlistName"/>
|
<TextBlock Text="[Playlsit name]" FontSize="26" TextWrapping="WrapWholeWords" Name="playlistName"/>
|
||||||
<TextBlock Text="DAGames" Name="playlistChannel"/>
|
<TextBlock Text="[Channel name]" Name="playlistChannel"/>
|
||||||
<TextBlock Text="15/155" Name="playlistCounter"/>
|
<TextBlock Text="[Counter]" Name="playlistCounter"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ListBox Background="Transparent" SelectionChanged="ListBox_SelectionChanged" Name="playlistList">
|
<ListBox Background="Transparent" SelectionChanged="ListBox_SelectionChanged" Name="playlistList">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using FoxTube.Controls;
|
using FoxTube.Controls;
|
||||||
using FoxTube.Controls.Adverts;
|
|
||||||
using Google.Apis.YouTube.v3;
|
using Google.Apis.YouTube.v3;
|
||||||
using Google.Apis.YouTube.v3.Data;
|
using Google.Apis.YouTube.v3.Data;
|
||||||
using Microsoft.AppCenter.Analytics;
|
using Microsoft.AppCenter.Analytics;
|
||||||
@@ -8,6 +7,8 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Windows.ApplicationModel.DataTransfer;
|
using Windows.ApplicationModel.DataTransfer;
|
||||||
using Windows.ApplicationModel.Resources;
|
using Windows.ApplicationModel.Resources;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
@@ -52,6 +53,7 @@ namespace FoxTube.Pages
|
|||||||
public Video item;
|
public Video item;
|
||||||
|
|
||||||
bool isExtended = false;
|
bool isExtended = false;
|
||||||
|
bool playlistLoaded = false;
|
||||||
|
|
||||||
Rating userRating = Rating.None;
|
Rating userRating = Rating.None;
|
||||||
|
|
||||||
@@ -146,17 +148,19 @@ namespace FoxTube.Pages
|
|||||||
|
|
||||||
void SetSchedule()
|
void SetSchedule()
|
||||||
{
|
{
|
||||||
|
views.Visibility = Visibility.Collapsed;
|
||||||
|
upcoming.Visibility = Visibility.Visible;
|
||||||
if (item.LiveStreamingDetails.ScheduledEndTime.HasValue || item.LiveStreamingDetails.ScheduledStartTime.HasValue)
|
if (item.LiveStreamingDetails.ScheduledEndTime.HasValue || item.LiveStreamingDetails.ScheduledStartTime.HasValue)
|
||||||
schedule.Visibility = Visibility.Visible;
|
schedule.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
if (item.LiveStreamingDetails.ScheduledEndTime.HasValue)
|
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;
|
end.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
if (item.LiveStreamingDetails.ScheduledStartTime.HasValue)
|
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;
|
start.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
countdownPanel.Visibility = Visibility.Visible;
|
countdownPanel.Visibility = Visibility.Visible;
|
||||||
@@ -164,7 +168,7 @@ namespace FoxTube.Pages
|
|||||||
countdownTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
|
countdownTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
|
||||||
countdownTimer.Tick += (s, e) =>
|
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")
|
if (countdown.Text == "00:00:00")
|
||||||
refresh_Click(this, null);
|
refresh_Click(this, null);
|
||||||
};
|
};
|
||||||
@@ -186,30 +190,19 @@ namespace FoxTube.Pages
|
|||||||
PlaylistItemsResource.ListRequest listRequest = SecretsVault.Service.PlaylistItems.List("snippet");
|
PlaylistItemsResource.ListRequest listRequest = SecretsVault.Service.PlaylistItems.List("snippet");
|
||||||
listRequest.MaxResults = 50;
|
listRequest.MaxResults = 50;
|
||||||
listRequest.PlaylistId = id;
|
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();
|
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));
|
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++)
|
for (int k = 0; k < items.Count; k++)
|
||||||
items[k].Number = k + 1;
|
items[k].Number = k + 1;
|
||||||
@@ -224,6 +217,10 @@ namespace FoxTube.Pages
|
|||||||
playlistList.SelectedItem = selection;
|
playlistList.SelectedItem = selection;
|
||||||
pivot.SelectedItem = playlist;
|
pivot.SelectedItem = playlist;
|
||||||
|
|
||||||
|
await Task.Delay(500);
|
||||||
|
|
||||||
|
playlistScroll.ChangeView(null, playlistList.SelectedIndex * 86 + 89, null, true);
|
||||||
|
|
||||||
if (playlistList.SelectedIndex == playlistList.Items.Count - 1)
|
if (playlistList.SelectedIndex == playlistList.Items.Count - 1)
|
||||||
player.Controls.IsNextTrackButtonVisible = false;
|
player.Controls.IsNextTrackButtonVisible = false;
|
||||||
}
|
}
|
||||||
@@ -239,7 +236,7 @@ namespace FoxTube.Pages
|
|||||||
channelRequest.Id = item.Snippet.ChannelId;
|
channelRequest.Id = item.Snippet.ChannelId;
|
||||||
var item1 = (await channelRequest.ExecuteAsync()).Items[0];
|
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;
|
channelName.Text = item.Snippet.ChannelTitle;
|
||||||
subscribers.Text = $"{item1.Statistics.SubscriberCount:0,0} {resources.GetString("/Cards/subscribers")}";
|
subscribers.Text = $"{item1.Statistics.SubscriberCount:0,0} {resources.GetString("/Cards/subscribers")}";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user