@@ -4,6 +4,7 @@ using Google.Apis.YouTube.v3.Data;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Windows.ApplicationModel.Background;
|
using Windows.ApplicationModel.Background;
|
||||||
@@ -57,6 +58,9 @@ namespace FoxTube.Background
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Dictionary<string, string> subscriptions = JsonConvert.DeserializeObject<Dictionary<string, string>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("background.json")));
|
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)
|
foreach (var s in subscriptions)
|
||||||
{
|
{
|
||||||
SearchResource.ListRequest request = Service.Search.List("snippet");
|
SearchResource.ListRequest request = Service.Search.List("snippet");
|
||||||
@@ -67,10 +71,22 @@ namespace FoxTube.Background
|
|||||||
SearchListResponse response = await request.ExecuteAsync();
|
SearchListResponse response = await request.ExecuteAsync();
|
||||||
|
|
||||||
foreach (SearchResult i in response.Items)
|
foreach (SearchResult i in response.Items)
|
||||||
|
{
|
||||||
|
results.Add(i);
|
||||||
|
|
||||||
ToastNotificationManager.CreateToastNotifier().Show(
|
ToastNotificationManager.CreateToastNotifier().Show(
|
||||||
Notification.GetVideoToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title, i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, s.Value));
|
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 { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BackgroundProcessor.cs" />
|
<Compile Include="BackgroundProcessor.cs" />
|
||||||
<Compile Include="Notification.cs" />
|
<Compile Include="ResourceCreators.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -64,4 +64,52 @@ namespace FoxTube.Background
|
|||||||
return new ToastNotification(template);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
@@ -15,7 +15,7 @@
|
|||||||
</Resources>
|
</Resources>
|
||||||
<Applications>
|
<Applications>
|
||||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="FoxTube.App" ResourceGroup="foxtube">
|
<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:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" ShortName="FoxTube" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png">
|
||||||
<uap:ShowNameOnTiles>
|
<uap:ShowNameOnTiles>
|
||||||
<uap:ShowOn Tile="square150x150Logo" />
|
<uap:ShowOn Tile="square150x150Logo" />
|
||||||
|
|||||||
|
After Width: | Height: | Size: 19 KiB |