Archived
1
0

Added live tiles and corrected tiles' icons

Related Work Items: #213
This commit is contained in:
Michael Gordeev
2018-12-24 20:02:32 +03:00
parent e172890c4b
commit e2f741290d
10 changed files with 133 additions and 69 deletions
+16
View File
@@ -4,6 +4,7 @@ using Google.Apis.YouTube.v3.Data;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Xml;
using Windows.ApplicationModel.Background;
@@ -57,6 +58,9 @@ namespace FoxTube.Background
try
{
Dictionary<string, string> subscriptions = JsonConvert.DeserializeObject<Dictionary<string, string>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("background.json")));
List<SearchResult> results = new List<SearchResult>();
foreach (var s in subscriptions)
{
SearchResource.ListRequest request = Service.Search.List("snippet");
@@ -67,9 +71,21 @@ namespace FoxTube.Background
SearchListResponse response = await request.ExecuteAsync();
foreach (SearchResult i in response.Items)
{
results.Add(i);
ToastNotificationManager.CreateToastNotifier().Show(
Notification.GetVideoToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title, i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, s.Value));
}
}
results.OrderBy(i => i.Snippet.PublishedAt);
TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication();
updater.EnableNotificationQueue(true);
updater.Clear();
for (int i = 0; i < 5; i++)
updater.Update(Tiles.GetTileLayout(results[i].Snippet.Title, results[i].Snippet.ChannelTitle, results[i].Snippet.Thumbnails.Medium.Url, subscriptions[results[i].Snippet.ChannelId]));
}
catch { }
}