using Newtonsoft.Json; using System.Collections.Generic; using Windows.ApplicationModel.Resources; using Windows.Data.Xml.Dom; using Windows.Storage; using Windows.UI.Notifications; namespace FoxTube.Background { public static class Notification { private static Dictionary languagePack = LoadPack(); private static Dictionary LoadPack() { object[] saved = JsonConvert.DeserializeObject(ApplicationData.Current.RoamingSettings.Values["settings"] as string); if (saved[7] as string == "ru-RU") return new Dictionary() { { "addLater", "Добавить в Посмотреть позже" }, { "changelog", "Список изменений" }, { "changelogHeader", "Что нового в версии" }, { "videoContent", "загрузил новое видео" }, { "goChannel", "Открыть канал" } }; else return new Dictionary() { { "addLater", "Add to Watch later" }, { "changelog", "Changelog" }, { "changelogHeader", "What's new in version" }, { "videoContent", "uploaded a new video" }, { "goChannel", "Go to channel" } }; } public static ToastNotification GetChangelogToast(string version) { XmlDocument template = new XmlDocument(); template.LoadXml($@" {languagePack["changelog"]} {languagePack["changelogHeader"]} {version} "); return new ToastNotification(template); } public static ToastNotification GetVideoToast(string id, string channelId, string title, string channel, string thumbnail, string avatar) { XmlDocument template = new XmlDocument(); template.LoadXml($@" {title} {channel} {languagePack["videoContent"]} "); return new ToastNotification(template); } public static ToastNotification GetInternalToast(string id, string header, string content, string thumbnail, string avatar) { XmlDocument template = new XmlDocument(); template.LoadXml($@" {header} {content} "); 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($@" {channel} {title} {channel} {title} {channel} {title} "); return new TileNotification(doc); } } }