Archived
1
0

Refactored core

UI navigation framework

Related Work Items: #408, #414, #416
This commit is contained in:
Michael Gordeev
2020-06-15 15:46:38 +03:00
parent c58d846057
commit 787a6e9f48
72 changed files with 2002 additions and 1227 deletions
+51
View File
@@ -0,0 +1,51 @@
using System.Linq;
using Microsoft.Toolkit.Uwp.Notifications;
using Google.Apis.Blogger.v3.Data;
using Windows.UI.Notifications;
using AngleSharp.Html.Parser;
namespace FoxTube.Utils
{
public static class ToastTemplates
{
public static ToastNotification GetBlogpostToast(Post post)
{
ToastContent toastContent = new ToastContent
{
Visual = new ToastVisual
{
BindingGeneric = new ToastBindingGeneric
{
Children =
{
new AdaptiveText
{
Text = new BindableString(post.Title)
},
new AdaptiveText()
{
Text = new BindableString(new HtmlParser().ParseDocument(post.Content).QuerySelector("p").TextContent),
HintMaxLines = 2
}
},
AppLogoOverride = new ToastGenericAppLogo
{
Source = post.Author.Image.Url,
HintCrop = ToastGenericAppLogoCrop.Circle
}
}
},
Launch = $"Settings/Inbox/{post.Id}",
ActivationType = ToastActivationType.Foreground
};
if (post.Images.Count > 0)
toastContent.Visual.BindingGeneric.HeroImage = new ToastGenericHeroImage
{
Source = post.Images.FirstOrDefault()?.Url
};
return new ToastNotification(toastContent.GetXml());
}
}
}