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 { }
}
+1 -1
View File
@@ -108,7 +108,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="BackgroundProcessor.cs" />
<Compile Include="Notification.cs" />
<Compile Include="ResourceCreators.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@@ -64,4 +64,52 @@ namespace FoxTube.Background
return new ToastNotification(template);
}
}
public static class Tiles
{
public static TileNotification GetTileLayout(string title, string channel, string thumbnail, string avatar)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml($@" <tile>
<visual>
<binding template='TileMedium' branding='none'>
<image placement='peek' src='{avatar?.Replace("&", "%26")}'/>
<image placement='background' src='{thumbnail?.Replace("&", "%26")}'/>
<text hint-style='base' hint-overlay='60'>{channel}</text>
<text hint-wrap='true' hint-style='captionSubtle'>{title}</text>
</binding>
<binding template='TileWide' Branding='nameAndLogo'>
<image placement='background' hint-overlay='60' src='{thumbnail?.Replace("&", "%26")}'/>
<group>
<subgroup hint-weight='33'>
<image src='{avatar?.Replace("&", "%26")}' hint-crop='circle' />
</subgroup>
<subgroup hint-textStacking='center'>
<text hint-style='base'>{channel}</text>
<text hint-wrap='true' hint-style='captionSubtle'>{title}</text>
</subgroup>
</group>
</binding>
<binding template='TileLarge' hint-textStacking='top' Branding='nameAndLogo'>
<image placement='background' hint-overlay='60' src='{thumbnail?.Replace("&", "%26")}'/>
<group>
<subgroup hint-weight='33'>
<image src='{avatar?.Replace("&", "%26")}' hint-crop='circle' />
</subgroup>
<subgroup hint-textStacking='center'>
<text hint-style='base'>{channel}</text>
<text hint-wrap='true' hint-style='captionSubtle'>{title}</text>
</subgroup>
</group>
</binding>
</visual>
</tile>");
return new TileNotification(doc);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

+1 -1
View File
@@ -15,7 +15,7 @@
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="FoxTube.App" ResourceGroup="foxtube">
<uap:VisualElements DisplayName="FoxTube" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YouTube Client" BackgroundColor="transparent">
<uap:VisualElements DisplayName="FoxTube" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YouTube Client" BackgroundColor="red">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" ShortName="FoxTube" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png">
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" />
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB