diff --git a/FoxTube/Classes/ObjectEventArgs.cs b/FoxTube/Classes/ObjectEventArgs.cs
index 27ac519..5e60964 100644
--- a/FoxTube/Classes/ObjectEventArgs.cs
+++ b/FoxTube/Classes/ObjectEventArgs.cs
@@ -7,4 +7,16 @@ using System.Threading.Tasks;
namespace FoxTube
{
public delegate void ObjectEventHandler(object sender, params object[] args);
+
+ public class SearchParameters
+ {
+ public string ChannelId { get; set; }
+ public string Term { get; set; }
+
+ public SearchParameters(string channelId, string term)
+ {
+ ChannelId = channelId;
+ Term = term;
+ }
+ }
}
diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj
index 082ee53..6fc1623 100644
--- a/FoxTube/FoxTube.csproj
+++ b/FoxTube/FoxTube.csproj
@@ -118,8 +118,8 @@
SuggestionsQueries.xaml
-
- Channel.xaml
+
+ ChannelPage.xaml
ChannelCardWide.xaml
@@ -302,7 +302,7 @@
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
diff --git a/FoxTube/Pages/Channel.xaml b/FoxTube/Pages/Channel.xaml
deleted file mode 100644
index c8df887..0000000
--- a/FoxTube/Pages/Channel.xaml
+++ /dev/null
@@ -1,145 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/FoxTube/Pages/Channel.xaml.cs b/FoxTube/Pages/Channel.xaml.cs
deleted file mode 100644
index 9da9828..0000000
--- a/FoxTube/Pages/Channel.xaml.cs
+++ /dev/null
@@ -1,182 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Controls.Primitives;
-using Windows.UI.Xaml.Data;
-using Windows.UI.Xaml.Input;
-using Windows.UI.Xaml.Media;
-using Windows.UI.Xaml.Navigation;
-
-using Google.Apis.Services;
-using Google.Apis.YouTube.v3;
-using Google.Apis.YouTube.v3.Data;
-using Windows.UI.Xaml.Media.Imaging;
-using Windows.UI.Text;
-using Windows.Storage;
-using FoxTube.Controls;
-using FoxTube.Pages;
-
-// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
-
-namespace FoxTube
-{
- ///
- /// An empty page that can be used on its own or navigated to within a Frame.
- ///
- public sealed partial class Channel : Page
- {
- ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
- public string channelId;
- public Google.Apis.YouTube.v3.Data.Channel item;
- VideoGrid videoGrid = new VideoGrid();
- public Channel()
- {
- this.InitializeComponent();
- }
-
- private void toAbout_Click(object sender, RoutedEventArgs e)
- {
- content.SelectedIndex = 2;
- }
-
- public async void Initialize(string id)
- {
- channelId = id;
-
- YouTubeService ytService = SecretsVault.NoAuthService;
-
- ChannelsResource.ListRequest request = ytService.Channels.List("snippet,contentDetails,statistics,brandingSettings");
- request.Id = id;
- ChannelListResponse response = await request.ExecuteAsync();
-
- item = response.Items[0];
-
- title.Text = item.Snippet.Title;
- subscribers.Text = item.Statistics.SubscriberCount + " subscribers";
- videosCount.Text = item.Statistics.VideoCount + " videos";
-
- channelCover.Source = new BitmapImage(new Uri(item.BrandingSettings.Image.BannerImageUrl));
- avatar.ProfilePicture = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url));
-
- description.Text = item.Snippet.Description;
- views.Text = item.Statistics.ViewCount.ToString();
- registration.Text = item.Snippet.PublishedAt.ToString();
-
- searchChannel.Text = item.Snippet.Title;
-
- SearchResource.ListRequest request2 = ytService.Search.List("snippet");
- request2.ChannelId = id;
- request2.Type = "video";
- request2.Order = SearchResource.ListRequest.OrderEnum.Date;
- request2.MaxResults = 48;
-
- SearchListResponse response2 = await request2.ExecuteAsync();
-
- videos.Children.Add(videoGrid);
-
- foreach(SearchResult vid in response2.Items)
- {
- VideoCard vCard = new VideoCard(vid.Id.VideoId);
- videoGrid.Add(vCard);
- }
- }
-
- private void toVideos_Click(object sender, RoutedEventArgs e)
- {
- content.SelectedIndex = 0;
- }
-
- private void toPlaylists_Click(object sender, RoutedEventArgs e)
- {
- content.SelectedIndex = 1;
- }
-
- private async void searchButton_Click(object sender, RoutedEventArgs e)
- {
- content.SelectedIndex = 3;
-
- YouTubeService ytService = SecretsVault.NoAuthService;
-
- var searchListRequest = ytService.Search.List("snippet");
- searchListRequest.Q = searchField.Text;
- searchListRequest.ChannelId = channelId;
- searchListRequest.MaxResults = 25;
- searchListRequest.SafeSearch = (SearchResource.ListRequest.SafeSearchEnum)(int)settings.Values["safeSearch"];
-
- var response = await searchListRequest.ExecuteAsync();
-
- SetResults(searchField.Text, (int)response.PageInfo.TotalResults);
- foreach (SearchResult result in response.Items)
- AddItem(result);
- searchRing.IsActive = false;
- displaying.Visibility = Visibility.Visible;
- }
-
- public void SetResults(string keyword, int count)
- {
- searchTerm.Text = keyword;
- resultsCount.Text = count.ToString();
- }
-
- public void AddItem(SearchResult result)
- {
- switch (result.Id.Kind)
- {
- case "youtube#video":
- VideoCardWide vCard = new VideoCardWide(result.Id.VideoId);
- resultsList.Children.Add(vCard);
- break;
-
- case "youtube#playlist":
- PlaylistCardWide pCard = new PlaylistCardWide(result.Id.PlaylistId);
- resultsList.Children.Add(pCard);
- break;
- }
- }
-
- private async void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- toVideos.FontWeight = FontWeights.Normal;
- toPlaylists.FontWeight = FontWeights.Normal;
- toAbout.FontWeight = FontWeights.Normal;
- if (content.SelectedIndex == 0)
- toVideos.FontWeight = FontWeights.Bold;
- else if (content.SelectedIndex == 1)
- {
- toPlaylists.FontWeight = FontWeights.Bold;
-
- if (playlists.Children.Count == 0)
- {
- YouTubeService ytService = SecretsVault.NoAuthService;
-
- PlaylistsResource.ListRequest request = ytService.Playlists.List("snippet,contentDetails");
- request.MaxResults = 25;
- request.ChannelId = channelId;
- PlaylistListResponse response = await request.ExecuteAsync();
-
- foreach (Playlist playlist in response.Items)
- {
- PlaylistCardWide playlistCard = new PlaylistCardWide(playlist.Id, true);
- playlists.Children.Add(playlistCard);
- }
-
- playlistRing.IsActive = false;
- playlistPane.Visibility = Visibility.Visible;
- }
- }
- else if (content.SelectedIndex == 2)
- toAbout.FontWeight = FontWeights.Bold;
- }
-
- private void showMorePlaylists_Click(object sender, RoutedEventArgs e)
- {
-
- }
- }
-}
diff --git a/FoxTube/Pages/ChannelPage.xaml b/FoxTube/Pages/ChannelPage.xaml
new file mode 100644
index 0000000..f363825
--- /dev/null
+++ b/FoxTube/Pages/ChannelPage.xaml
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Log in to manage your subscriptions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FoxTube/Pages/ChannelPage.xaml.cs b/FoxTube/Pages/ChannelPage.xaml.cs
new file mode 100644
index 0000000..0abfbf6
--- /dev/null
+++ b/FoxTube/Pages/ChannelPage.xaml.cs
@@ -0,0 +1,359 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+using Google.Apis.Services;
+using Google.Apis.YouTube.v3;
+using Google.Apis.YouTube.v3.Data;
+using Windows.UI.Xaml.Media.Imaging;
+using Windows.UI.Text;
+using Windows.Storage;
+using FoxTube.Controls;
+using FoxTube.Pages;
+using Windows.ApplicationModel.DataTransfer;
+using Windows.ApplicationModel;
+using Windows.Storage.Streams;
+using Windows.System;
+
+// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
+
+namespace FoxTube.Pages
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ public sealed partial class ChannelPage : Page
+ {
+ ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
+
+ public string channelId;
+ public Channel item;
+
+ LoadingPage loading, playlistLoading;
+ VideoGrid videoList, playlistList;
+ ShowMore videoMore, playlistMore;
+
+ SearchResource.ListRequest videoRequest, playlistRequest;
+
+ private string videoToken;
+ private string playlistToken;
+ private bool playlistLoaded = false;
+
+ public ChannelPage()
+ {
+ this.InitializeComponent();
+ loading = grid.Children[3] as LoadingPage;
+ playlistLoading = playlists.Children[1] as LoadingPage;
+
+ videoList = videos.Children[2] as VideoGrid;
+ playlistList = (playlists.Children[0] as StackPanel).Children[1] as VideoGrid;
+
+ videoMore = videos.Children[3] as ShowMore;
+ playlistMore = (playlists.Children[0] as StackPanel).Children[2] as ShowMore;
+
+ loading.RefreshPage += refresh_Click;
+ DataTransferManager.GetForCurrentView().DataRequested += new TypedEventHandler(Share);
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+ if (e.Parameter == null)
+ loading.Error("NullReferenceException", "Unable to initialize search. Search term is not stated.");
+ else
+ Initialize(e.Parameter as string);
+ }
+
+ public async void Initialize(string id)
+ {
+ content.SelectedIndex = 0;
+ loading.Refresh();
+ playlistLoading.Refresh();
+
+ try
+ {
+ channelId = id;
+ ChannelsResource.ListRequest request = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
+ request.Id = id;
+ if (content.Items.Count == 4)
+ content.Items.RemoveAt(3);
+
+ item = (await request.ExecuteAsync()).Items[0];
+
+ title.Text = item.Snippet.Title;
+ subscribers.Text = $"{item.Statistics.SubscriberCount:0,0} subscribers";
+ videosCount.Text = $"{item.Statistics.VideoCount:0,0} videos";
+
+ try
+ {
+ channelCover.Source = new BitmapImage(new Uri(item.BrandingSettings.Image.BannerImageUrl));
+ avatar.ProfilePicture = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url));
+ }
+ catch { }
+
+ description.Text = item.Snippet.Description;
+ views.Text = $"{item.Statistics.ViewCount:0,0}";
+ registration.Text = item.Snippet.PublishedAt.ToString();
+
+ videoRequest = SecretsVault.Service.Search.List("id");
+ videoRequest.ChannelId = id;
+ videoRequest.Type = "video";
+ videoRequest.Order = SearchResource.ListRequest.OrderEnum.Date;
+ videoRequest.MaxResults = 48;
+
+ SearchListResponse response = await videoRequest.ExecuteAsync();
+
+ videoList.Clear();
+ foreach (SearchResult i in response.Items)
+ {
+ VideoCard card = new VideoCard(i.Id.VideoId);
+ videoList.Add(card);
+ }
+
+ if (!string.IsNullOrWhiteSpace(response.NextPageToken))
+ videoToken = response.NextPageToken;
+ else
+ videoMore.Complete(true);
+
+ if (SecretsVault.IsAuthorized)
+ {
+ foreach (Subscription s in SecretsVault.Subscriptions)
+ {
+ if (s.Snippet.ResourceId.ChannelId == id)
+ {
+ subscribe.IsChecked = true;
+ subscribe.Content = "Subscribed";
+ }
+ }
+ subscriptionPane.Visibility = Visibility.Visible;
+ }
+
+ loading.Close();
+ }
+ catch
+ {
+ loading.Error();
+ }
+ }
+
+ async void LoadPlaylist()
+ {
+ try
+ {
+ playlistLoading.Refresh();
+
+ playlistRequest = SecretsVault.Service.Search.List("id");
+ playlistRequest.ChannelId = channelId;
+ playlistRequest.Type = "playlist";
+ playlistRequest.Order = SearchResource.ListRequest.OrderEnum.Date;
+ playlistRequest.MaxResults = 48;
+
+ SearchListResponse response = await playlistRequest.ExecuteAsync();
+
+ playlistList.Clear();
+ foreach (SearchResult i in response.Items)
+ {
+ PlaylistCard card = new PlaylistCard(i.Id.PlaylistId);
+ playlistList.Add(card);
+ }
+
+ if (!string.IsNullOrWhiteSpace(response.NextPageToken))
+ playlistToken = response.NextPageToken;
+ else
+ playlistMore.Complete(true);
+
+ playlistLoading.Close();
+ }
+ catch
+ {
+ playlistLoading.Error();
+ }
+ }
+
+ private void searchButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (content.Items.Count == 4)
+ (((content.Items[3] as PivotItem).Content as Frame).Content as Search).Initialize(new SearchParameters(item.Id, searchField.Text));
+ else
+ {
+ content.Items.Add(new PivotItem()
+ {
+ Content = new Frame()
+ });
+ ((content.Items[3] as PivotItem).Content as Frame).Navigate(typeof(Search), new SearchParameters(item.Id, searchField.Text));
+ }
+
+ content.SelectedIndex = 3;
+ }
+
+ private void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ toVideos.FontWeight = FontWeights.Normal;
+ toPlaylists.FontWeight = FontWeights.Normal;
+ toAbout.FontWeight = FontWeights.Normal;
+
+ switch (content.SelectedIndex)
+ {
+ case 0:
+ toVideos.FontWeight = FontWeights.Bold;
+ break;
+ case 1:
+ toPlaylists.FontWeight = FontWeights.Bold;
+ if (!playlistLoaded)
+ LoadPlaylist();
+ break;
+ case 2:
+ toAbout.FontWeight = FontWeights.Bold;
+ break;
+ }
+ }
+
+ private void toVideos_Click(object sender, RoutedEventArgs e)
+ {
+ content.SelectedIndex = 0;
+ }
+
+ private void toPlaylists_Click(object sender, RoutedEventArgs e)
+ {
+ content.SelectedIndex = 1;
+ }
+
+ private void toAbout_Click(object sender, RoutedEventArgs e)
+ {
+ content.SelectedIndex = 2;
+ }
+
+ private async void showMorePlaylists_Click()
+ {
+ playlistRequest.PageToken = playlistToken;
+ SearchListResponse response = await playlistRequest.ExecuteAsync();
+
+ foreach (SearchResult i in response.Items)
+ {
+ PlaylistCard card = new PlaylistCard(i.Id.PlaylistId);
+ playlistList.Add(card);
+ }
+
+ if (!string.IsNullOrWhiteSpace(response.NextPageToken))
+ {
+ playlistToken = response.NextPageToken;
+ playlistMore.Complete();
+ }
+ else
+ playlistMore.Complete(true);
+ }
+
+ private async void videoMore_Clicked()
+ {
+ videoRequest.PageToken = videoToken;
+ SearchListResponse response = await videoRequest.ExecuteAsync();
+
+ foreach (SearchResult i in response.Items)
+ {
+ VideoCard card = new VideoCard(i.Id.VideoId);
+ videoList.Add(card);
+ }
+
+ if (!string.IsNullOrWhiteSpace(response.NextPageToken))
+ {
+ videoToken = response.NextPageToken;
+ videoMore.Complete();
+ }
+ else
+ videoMore.Complete(true);
+ }
+
+ private async void subscribe_Click(object sender, RoutedEventArgs e)
+ {
+ if (subscribe.IsChecked.Value)
+ {
+ if (!await SecretsVault.Subscribe(channelId))
+ subscribe.IsChecked = false;
+ else
+ subscribe.Content = "Subscribed";
+ }
+ else
+ {
+ if (!await SecretsVault.Unsubscibe(channelId))
+ subscribe.IsChecked = true;
+ else
+ subscribe.Content = "Subscribe";
+ }
+ }
+
+ private void Hyperlink_Click(Windows.UI.Xaml.Documents.Hyperlink sender, Windows.UI.Xaml.Documents.HyperlinkClickEventArgs args)
+ {
+ SecretsVault.Authorize();
+ }
+
+ private void refresh_Click(object sender, RoutedEventArgs e)
+ {
+ Initialize(channelId);
+ }
+
+ private async void inBrowser_Click(object sender, RoutedEventArgs e)
+ {
+ if (!string.IsNullOrWhiteSpace(item.Snippet.CustomUrl))
+ await Launcher.LaunchUriAsync(new Uri($"https://www.youtube.com/user/{item.Snippet.CustomUrl}"));
+ else
+ await Launcher.LaunchUriAsync(new Uri($"https://www.youtube.com/channel/{item.Id}"));
+ }
+
+ private void share_Click(object sender, RoutedEventArgs e)
+ {
+ DataTransferManager.ShowShareUI();
+ }
+
+ private async void Share(DataTransferManager sender, DataRequestedEventArgs args)
+ {
+ DataRequest request = args.Request;
+ request.Data.Properties.Title = item.Snippet.Title;
+ request.Data.Properties.Description = "Sharing a channel";
+
+ // Handle errors
+ //request.FailWithDisplayText("Something unexpected could happen.");
+
+ // Plain text
+ request.Data.SetText(item.Snippet.Title + "\n" + "#YouTube #FoxTube #SharedWithFoxTube");
+
+ // Uniform Resource Identifiers (URIs)
+ if(!string.IsNullOrWhiteSpace(item.Snippet.CustomUrl))
+ request.Data.SetWebLink(new Uri($"https://www.youtube.com/user/{item.Snippet.CustomUrl}"));
+ else
+ request.Data.SetWebLink(new Uri($"https://www.youtube.com/channel/{item.Id}"));
+
+ // HTML
+ //request.Data.SetHtmlFormat("Bold Text");
+
+ // Because we are making async calls in the DataRequested event handler,
+ // we need to get the deferral first.
+ DataRequestDeferral deferral = request.GetDeferral();
+
+ // Make sure we always call Complete on the deferral.
+ try
+ {
+ StorageFile thumbnailFile = await Package.Current.InstalledLocation.GetFileAsync(item.Snippet.Thumbnails.Medium.Url);
+ request.Data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(thumbnailFile);
+ StorageFile imageFile = await Package.Current.InstalledLocation.GetFileAsync(item.Snippet.Thumbnails.Medium.Url);
+
+ // Bitmaps
+ request.Data.SetBitmap(RandomAccessStreamReference.CreateFromFile(imageFile));
+ }
+ finally
+ {
+ deferral.Complete();
+ }
+ }
+ }
+}
diff --git a/FoxTube/Pages/MainPage.xaml b/FoxTube/Pages/MainPage.xaml
index 0e9990d..699a6c5 100644
--- a/FoxTube/Pages/MainPage.xaml
+++ b/FoxTube/Pages/MainPage.xaml
@@ -185,58 +185,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs
index 565a93e..3bccfa2 100644
--- a/FoxTube/Pages/MainPage.xaml.cs
+++ b/FoxTube/Pages/MainPage.xaml.cs
@@ -225,7 +225,6 @@ namespace FoxTube
return;
subscriptionsList.SelectedItem = null;
- categoriesList.SelectedItem = null;
serviceList.SelectedItem = null;
object s = mainList.SelectedItem;
@@ -255,7 +254,6 @@ namespace FoxTube
mainList.SelectedItem = null;
subscriptionsList.SelectedItem = null;
- categoriesList.SelectedItem = null;
object s = serviceList.SelectedItem;
@@ -277,49 +275,9 @@ namespace FoxTube
return;
mainList.SelectedItem = null;
- categoriesList.SelectedItem = null;
serviceList.SelectedItem = null;
- content.Navigate(typeof(Channel), SecretsVault.Subscriptions[subscriptionsList.SelectedIndex - 1].Snippet.ChannelId);
- }
- catch { }
- }
-
- void FeaturedSelected(object sender, SelectionChangedEventArgs e)
- {
- try
- {
- if (serviceList.SelectedItem == null)
- return;
-
- mainList.SelectedItem = null;
- subscriptionsList.SelectedItem = null;
- serviceList.SelectedItem = null;
-
- switch (categoriesList.SelectedIndex)
- {
- case 0:
- GoToChannel("UC-9-kyTW8ZkZNDHQJ6FgpwQ");
- break;
- case 1:
- GoToChannel("UCEgdi0XIXXZ-qJOFPf4JSKw");
- break;
- case 2:
- GoToChannel("UCOpNcN46UbXVtpKMrmU4Abg");
- break;
- case 3:
- GoToChannel("UCYfdidRxbB8Qhf0Nx7ioOYw");
- break;
- case 4:
- GoToChannel("UC4R8DWoMoI7CAwX8_LjQHig");
- break;
- case 5:
- GoToChannel("UC8iNz9uwDGfomRnnKKbOhOQ");
- break;
- case 6:
- GoToChannel("UCzuqhhs6NWbgTzMuM09WKDQ");
- break;
- }
+ GoToChannel(SecretsVault.Subscriptions[subscriptionsList.SelectedIndex - 1].Snippet.ResourceId.ChannelId);
}
catch { }
}
@@ -343,7 +301,6 @@ namespace FoxTube
private void menu_PaneClosed(SplitView sender, object args)
{
subsTitle.Visibility = Visibility.Collapsed;
- catTitle.Visibility = Visibility.Collapsed;
}
private void menu_PaneOpened(SplitView sender, object args)
@@ -351,7 +308,6 @@ namespace FoxTube
try
{
subsTitle.Visibility = Visibility.Visible;
- catTitle.Visibility = Visibility.Visible;
}
catch { }
}
@@ -468,7 +424,7 @@ namespace FoxTube
public void GoToChannel(string id)
{
MinimizeVideo();
- content.Navigate(typeof(Channel), id);
+ content.Navigate(typeof(ChannelPage), id);
}
public void GoToVideo(string id)
diff --git a/FoxTube/Pages/PlaylistPage.xaml.cs b/FoxTube/Pages/PlaylistPage.xaml.cs
index 02e3fe7..b52a8bb 100644
--- a/FoxTube/Pages/PlaylistPage.xaml.cs
+++ b/FoxTube/Pages/PlaylistPage.xaml.cs
@@ -53,15 +53,13 @@ namespace FoxTube.Pages
loading.Error("NullReferenceException", "Unable to initialize search. Search term is not stated.");
else
Initialize(e.Parameter as string);
-
-
}
public async void Initialize(string id)
{
loading.Refresh();
- //try
+ try
{
playlistId = id;
PlaylistsResource.ListRequest request = SecretsVault.Service.Playlists.List("snippet,contentDetails");
@@ -80,7 +78,7 @@ namespace FoxTube.Pages
thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url));
ChannelsResource.ListRequest channelRequest = SecretsVault.Service.Channels.List("snippet");
channelRequest.Id = item.Snippet.ChannelId;
- Google.Apis.YouTube.v3.Data.Channel channel = (await channelRequest.ExecuteAsync()).Items[0];
+ Channel channel = (await channelRequest.ExecuteAsync()).Items[0];
avatar.ProfilePicture = new BitmapImage(new Uri(channel.Snippet.Thumbnails.Medium.Url));
}
catch { }
@@ -106,7 +104,7 @@ namespace FoxTube.Pages
loading.Close();
}
- //catch
+ catch
{
loading.Error();
}
diff --git a/FoxTube/Pages/Search.xaml.cs b/FoxTube/Pages/Search.xaml.cs
index c5f37de..be4177c 100644
--- a/FoxTube/Pages/Search.xaml.cs
+++ b/FoxTube/Pages/Search.xaml.cs
@@ -82,10 +82,23 @@ namespace FoxTube
if (e.Parameter == null)
loading.Error("NullReferenceException", "Unable to initialize search. Search term is not stated.");
else
- Initialize(e.Parameter as string);
+ {
+ if (e.Parameter is string)
+ Initialize(e.Parameter as string);
+ else if (e.Parameter is SearchParameters)
+ Initialize(e.Parameter as SearchParameters);
+ else
+ loading.Error("ArgumentException", "Wrong search parameters");
+ }
+
}
- public async void Initialize(string term, bool forceInitialization = false)
+ public void Initialize(SearchParameters arg)
+ {
+ Initialize(arg.Term, channelId: arg.ChannelId);
+ }
+
+ public async void Initialize(string term, bool forceInitialization = false, string channelId = null)
{
if (term == Term && !forceInitialization)
return;
@@ -95,6 +108,11 @@ namespace FoxTube
{
Term = term;
request = SecretsVault.Service.Search.List("id");
+ if (!string.IsNullOrWhiteSpace(channelId))
+ {
+ request.ChannelId = channelId;
+ (grid.Children[1] as CommandBar).Visibility = Visibility.Collapsed;
+ }
request.Q = term;
request.SafeSearch = (SearchResource.ListRequest.SafeSearchEnum)(int)settings.Values["safeSearch"];
try