From 0522521b2c1fa7e9a87df69e001cd09e43bd53dc Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Mon, 20 Aug 2018 15:20:51 +0300 Subject: [PATCH] tiles design, home page development --- FoxTube/Pages/Home.xaml.cs | 30 ++++++++++++++++++++++++------ Src/Tiles.xml | 1 + 2 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 Src/Tiles.xml diff --git a/FoxTube/Pages/Home.xaml.cs b/FoxTube/Pages/Home.xaml.cs index 5d1fe95..45bd264 100644 --- a/FoxTube/Pages/Home.xaml.cs +++ b/FoxTube/Pages/Home.xaml.cs @@ -99,7 +99,7 @@ namespace FoxTube private void SubsMore_Clicked() { - throw new NotImplementedException(); + } public void Initialize() @@ -256,21 +256,39 @@ namespace FoxTube } } - void LoadSubscriptions() + async void LoadSubscriptions() { try { + List items = new List(); + SearchResource.ListRequest request = SecretsVault.Service.Search.List("snippet"); + request.Type = "video"; + request.MaxResults = 20; + request.Order = SearchResource.ListRequest.OrderEnum.Date; + + foreach (Subscription i in SecretsVault.Subscriptions) + { + request.ChannelId = i.Snippet.ResourceId.ChannelId; + SearchListResponse response = await request.ExecuteAsync(); + foreach (SearchResult result in response.Items) + items.Add(result); + } + subsMore.Complete(true); + + items.OrderBy(x => x.Snippet.PublishedAt.Value); + + foreach (SearchResult i in items) + subsGrid.Add(new VideoCard(i.Id.VideoId)); + subsLoading.Close(); - subsLoaded = true; - subsLoading.Block(); } catch (System.Net.Http.HttpRequestException) { subsLoading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true); } - catch + catch (Exception e) { - subsLoading.Error(); + subsLoading.Error(e.ToString(), e.Message); } } } diff --git a/Src/Tiles.xml b/Src/Tiles.xml new file mode 100644 index 0000000..28d8e18 --- /dev/null +++ b/Src/Tiles.xml @@ -0,0 +1 @@ + DAGames Will Ryan - I Am The Animal (Official Lyric Video) - DAGames DAGames Will Ryan - I Am The Animal (Official Lyric Video) - DAGames DAGames Will Ryan - I Am The Animal (Official Lyric Video) - DAGames \ No newline at end of file