Archived
1
0

Notificaions development 0

This commit is contained in:
Michael Gordeev
2018-10-24 16:46:22 +03:00
parent 4cb9bdd8cb
commit dc8afa2891
10 changed files with 165 additions and 335 deletions
+54 -90
View File
@@ -16,13 +16,8 @@ using Windows.UI.Notifications;
namespace FoxTube.Background namespace FoxTube.Background
{ {
public delegate void NotificationHandler(object sender, Notification item);
public sealed class BackgroundProcessor : IBackgroundTask public sealed class BackgroundProcessor : IBackgroundTask
{ {
public static event NotificationHandler NotificationRecieved;
List<Notification> Notifications = new List<Notification>();
private DateTime lastCheck = DateTime.Now; private DateTime lastCheck = DateTime.Now;
private ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; private ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
@@ -37,8 +32,6 @@ namespace FoxTube.Background
ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0", ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
ApplicationName = "FoxTube" ApplicationName = "FoxTube"
}); });
XmlDocument doc = new XmlDocument();
BackgroundTaskDeferral def; BackgroundTaskDeferral def;
public void Run(IBackgroundTaskInstance taskInstance) public void Run(IBackgroundTaskInstance taskInstance)
@@ -47,110 +40,81 @@ namespace FoxTube.Background
if (settings.Values["lastCheck"] == null) if (settings.Values["lastCheck"] == null)
settings.Values.Add("lastCheck", XmlConvert.ToString(DateTime.Now, "YYYY-MM-DDThh:mm:ss")); settings.Values.Add("lastCheck", XmlConvert.ToString(DateTime.Now, "YYYY-MM-DDThh:mm:ss"));
else lastCheck = XmlConvert.ToDateTime(settings.Values["lastCheck"] as string, XmlDateTimeSerializationMode.Unspecified); else lastCheck = XmlConvert.ToDateTime(settings.Values["lastCheck"] as string, XmlDateTimeSerializationMode.Unspecified);
if((bool)settings.Values["newVideoNotification"])
CheckAnnouncements();
if((bool)settings.Values["devNews"])
CheckAccount();
try settings.Values["lastCheck"] = XmlConvert.ToString(DateTime.Now, "YYYY-MM-DDThh:mm:ss");
{
doc.LoadXml(settings.Values["notificationsHistory"] as string);
}
catch
{
return;
}
CheckAnnouncements();
CheckAccount();
SendNSave();
def.Complete(); def.Complete();
} }
async void CheckAccount() async void CheckAccount()
{ {
UserCredential credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(Secrets, new[] { Google.Apis.Oauth2.v2.Oauth2Service.Scope.UserinfoProfile, YouTubeService.Scope.YoutubeForceSsl }, "user", CancellationToken.None); try
if (credential == null)
return;
SubscriptionsResource.ListRequest subRequest = new YouTubeService(new BaseClientService.Initializer()
{ {
HttpClientInitializer = credential, UserCredential credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(Secrets, new[] { Google.Apis.Oauth2.v2.Oauth2Service.Scope.UserinfoProfile, YouTubeService.Scope.YoutubeForceSsl }, "user", CancellationToken.None);
ApplicationName = "FoxTube" if (credential == null)
}).Subscriptions.List("snippet"); return;
subRequest.Mine = true;
subRequest.MaxResults = 50;
SubscriptionListResponse subResponse = await subRequest.ExecuteAsync();
Dictionary<string, string> subs = new Dictionary<string, string>();
foreach (Subscription s in subResponse.Items) SubscriptionsResource.ListRequest subRequest = new YouTubeService(new BaseClientService.Initializer()
subs.Add(s.Snippet.ResourceId.ChannelId, s.Snippet.Thumbnails.Standard.Url); {
HttpClientInitializer = credential,
string nextToken = subResponse.NextPageToken; ApplicationName = "FoxTube"
while (nextToken != null) }).Subscriptions.List("snippet");
{ subRequest.Mine = true;
subRequest.PageToken = nextToken; subRequest.MaxResults = 50;
subResponse = await subRequest.ExecuteAsync(); SubscriptionListResponse subResponse = await subRequest.ExecuteAsync();
nextToken = subResponse.NextPageToken; Dictionary<string, string> subs = new Dictionary<string, string>();
foreach (Subscription s in subResponse.Items) foreach (Subscription s in subResponse.Items)
subs.Add(s.Snippet.ResourceId.ChannelId, s.Snippet.Thumbnails.Standard.Url); subs.Add(s.Snippet.ResourceId.ChannelId, s.Snippet.Thumbnails.Standard.Url);
}
foreach(var s in subs) string nextToken = subResponse.NextPageToken;
{ while (nextToken != null)
SearchResource.ListRequest request = Service.Search.List("snippet"); {
request.PublishedAfter = lastCheck; subRequest.PageToken = nextToken;
request.ChannelId = s.Key; subResponse = await subRequest.ExecuteAsync();
request.Type = "video"; nextToken = subResponse.NextPageToken;
SearchListResponse response = await request.ExecuteAsync();
foreach (var i in response.Items) foreach (Subscription s in subResponse.Items)
Notifications.Add(new Notification("video", i.Id.VideoId, subs.Add(s.Snippet.ResourceId.ChannelId, s.Snippet.Thumbnails.Standard.Url);
i.Snippet.ChannelTitle, }
i.Snippet.Title,
i.Snippet.PublishedAt.Value, foreach (var s in subs)
i.Snippet.Thumbnails.Standard.Url, {
s.Value)); SearchResource.ListRequest request = Service.Search.List("snippet");
request.PublishedAfter = lastCheck;
request.ChannelId = s.Key;
request.Type = "video";
request.MaxResults = 5;
SearchListResponse response = await request.ExecuteAsync();
foreach (var i in response.Items)
ToastNotificationManager.CreateToastNotifier().Show(
Notification.GetVideoToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title, i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, s.Value));
}
} }
catch { }
} }
void CheckAnnouncements() void CheckAnnouncements()
{ {
XmlDocument doc = new XmlDocument(); try
doc.Load(XmlReader.Create("http://foxgame.hol.es/foxtube-messages.xml"));
if ((XmlConvert.ToDateTimeOffset((doc["posts"].FirstChild as XmlElement).GetAttribute("time"), "YYYY-MM-DDThh:mm:ss") - lastCheck.ToUniversalTime()).TotalSeconds > 0)
Notifications.Add(new Notification("internal", (doc["posts"].FirstChild as XmlElement).GetAttribute("id"),
doc["posts"].FirstChild["header"].InnerText,
doc["posts"].FirstChild["notificationHeader"].InnerText,
XmlConvert.ToDateTimeOffset((doc["posts"].FirstChild as XmlElement).GetAttribute("time"), "YYYY-MM-DDThh:mm:ss"),
(doc["posts"].FirstChild as XmlElement).GetAttribute("image"), (doc["posts"].FirstChild as XmlElement).GetAttribute("avatar")));
}
void SendNotification(Notification notification)
{
ToastNotificationManager.CreateToastNotifier().Show(notification.GetToast());
}
void SendNSave()
{
foreach (Notification n in Notifications)
{ {
NotificationRecieved.Invoke(this, n); XmlDocument doc = new XmlDocument();
doc["history"].InnerXml += n.GetXml(); doc.Load(XmlReader.Create("http://foxgame.hol.es/foxtube-messages.xml"));
if ((XmlConvert.ToDateTimeOffset((doc["posts"].FirstChild as XmlElement).GetAttribute("time"), "YYYY-MM-DDThh:mm:ss") - lastCheck.ToUniversalTime()).TotalSeconds > 0)
ToastNotificationManager.CreateToastNotifier().Show(
Notification.GetInternalToast(doc["posts"].FirstChild["id"].InnerText,
doc["posts"].FirstChild["header"].InnerText,
doc["posts"].FirstChild["content"].InnerText,
doc["posts"].FirstChild["thumbnail"].InnerText,
doc["posts"].FirstChild["avatar"].InnerText));
} }
settings.Values.Add("notificationsHistory", doc.InnerXml); catch { }
foreach (Notification n in Notifications)
switch (n.Type)
{
case NotificationType.Video:
if ((bool)settings.Values["newVideoNotification"])
SendNotification(n);
break;
case NotificationType.Internal:
SendNotification(n);
break;
}
} }
} }
} }
+48 -216
View File
@@ -1,235 +1,67 @@
using System; using Windows.Data.Xml.Dom;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Data.Xml.Dom;
using Windows.UI;
using Windows.UI.Notifications; using Windows.UI.Notifications;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
namespace FoxTube.Background namespace FoxTube.Background
{ {
public enum NotificationType public static class Notification
{ {
Video, Comment, Post, Internal, Changelog public static ToastNotification GetChangelogToast(string version)
}
public sealed class Notification
{
public string Channel { get; set; }
public string Content { get; set; }
public DateTimeOffset TimeStamp { get; set; }
public NotificationType Type { get; set; }
public string Avatar { get; set; }
public string Thumbnail { get; set; }
public string Id { get; set; }
public Notification(string type, string id,
string channelName, string content, DateTimeOffset date,
string thumbnailUrl, string avatarUrl)
{
Channel = channelName;
Content = content;
TimeStamp = date;
Id = id;
Type = TypeConversion(type);
Avatar = avatarUrl ?? "ms-appx:///Assets/Icons/Profile.png";
Thumbnail = thumbnailUrl;
}
public Notification(string xmlSource)
{
System.Xml.XmlDocument d = new System.Xml.XmlDocument();
d.InnerXml = xmlSource;
System.Xml.XmlElement xml = d["item"];
Channel = xml["channelName"].InnerText;
Content = xml["content"].InnerText;
TimeStamp = DateTimeOffset.Parse(xml.GetAttribute("time"));
Id = xml.GetAttribute("id");
Type = TypeConversion(xml.GetAttribute("type"));
Avatar = xml["images"].GetAttribute("avatar");
Thumbnail = xml["images"].GetAttribute("thumbnail");
}
public string GetXml()
{
return $@"<item time='{TimeStamp.ToString("YYYY-MM-DDThh:mm:ss")}' type='{TypeConversion(Type)}' id='{Id}'>
<images thumbnail='{Thumbnail}' avatar='{Avatar}'/>
<channelName>{Channel}</channelName>
<content>{Content}</content>
</item>";
}
public Button GetNotification()
{
StackPanel stackPanel = new StackPanel() { Margin = new Thickness(10, 0, 0, 0) };
//Channel
switch (Type)
{
case NotificationType.Internal:
stackPanel.Children.Add(new TextBlock()
{
FontSize = 14,
FontStyle = Windows.UI.Text.FontStyle.Italic,
Foreground = new SolidColorBrush(Colors.Gray),
Text = "Developer's message"
});
break;
case NotificationType.Changelog:
stackPanel.Children.Add(new TextBlock()
{
FontSize = 14,
FontStyle = Windows.UI.Text.FontStyle.Italic,
Foreground = new SolidColorBrush(Colors.Gray),
Text = "Changelog"
});
break;
case NotificationType.Video:
stackPanel.Children.Add(new TextBlock()
{
FontSize = 14,
FontStyle = Windows.UI.Text.FontStyle.Italic,
Foreground = new SolidColorBrush(Colors.Gray),
Text = $"{Channel} uploaded new video"
});
break;
}
//Content
stackPanel.Children.Add(new TextBlock()
{
TextWrapping = TextWrapping.WrapWholeWords,
Text = Content,
});
//Time
stackPanel.Children.Add(new TextBlock()
{
FontSize = 13,
Foreground = new SolidColorBrush(Colors.Gray),
Text = TimeStamp.ToString()
});
PersonPicture avatar = new PersonPicture()
{
Height = 50,
VerticalAlignment = VerticalAlignment.Top,
ProfilePicture = string.IsNullOrWhiteSpace(Avatar) ? null : new BitmapImage(new Uri(Avatar))
};
Grid grid = new Grid();
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) });
grid.ColumnDefinitions.Add(new ColumnDefinition());
grid.Children.Add(avatar);
Grid.SetColumn(stackPanel, 1);
grid.Children.Add(stackPanel);
Button item = new Button()
{
HorizontalAlignment = HorizontalAlignment.Stretch,
HorizontalContentAlignment = HorizontalAlignment.Left,
Background = new SolidColorBrush(Colors.Transparent),
Content = grid
};
return item;
}
public ToastNotification GetToast()
{ {
XmlDocument template = new XmlDocument(); XmlDocument template = new XmlDocument();
switch (Type)
{
case NotificationType.Video:
template.LoadXml($@"<toast launch='video={Id}'>
<visual>
<binding template='ToastGeneric'>
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
<text>{Content}</text>
<text>{Channel} uploaded a new video</text>
<image src='{Thumbnail}'/>
</binding>
</visual>
<actions> template.LoadXml($@"<toast activationType='foreground' launch='changelog-{version.Replace(".", "-")}'>
<action content='Watch later' <visual>
activationType='background' <binding template='ToastGeneric'>
arguments='video&{Id}&later'/> <image placement='hero' src='http://foxgame.hol.es/FoxTubeAssets/WhatsNewThumb.png'/>
<action content='Go to channel' <image placement='appLogoOverride' hint-crop='circle' src='http://foxgame.hol.es/FoxTubeAssets/NewsAvatar.png'/>
arguments='video&{Id}&channel'/> <text>Changelog</text>
</actions> <text>See what's new in version {version}</text>
</toast>"); </binding>
break; </visual>
</toast>");
case NotificationType.Changelog:
template.LoadXml($@"<toast launch='{Id}'>
<visual>
<binding template='ToastGeneric'>
<image placement='hero' src='http://foxgame.hol.es/FoxTubeAssets/WhatsNewThumb.png'/>
<image placement='appLogoOverride' hint-crop='circle' src='http://foxgame.hol.es/FoxTubeAssets/NewsAvatar.png'/>
<text>{Content}</text>
<text>{Channel}</text>
</binding>
</visual>
</toast>");
break;
case NotificationType.Internal:
template.LoadXml($@"<toast launch='internal={Id}'>
<visual>
<binding template='ToastGeneric'>
<image placement='hero' src='{Thumbnail}'/>
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
<text>{Content}</text>
<text hint-maxLines='5'>{Channel}</text>
</binding>
</visual>
</toast>");
break;
}
return new ToastNotification(template); return new ToastNotification(template);
} }
private string TypeConversion(NotificationType type) public static ToastNotification GetVideoToast(string id, string channelId, string title, string channel, string thumbnail, string avatar)
{ {
switch(type) XmlDocument template = new XmlDocument();
{
case NotificationType.Comment: template.LoadXml($@"<toast activationType='foreground' launch='video-{id}'>
return "comment"; <visual>
case NotificationType.Post: <binding template='ToastGeneric'>
return "post"; <image placement='hero' src='{thumbnail}'/>
case NotificationType.Video: <image placement='appLogoOverride' hint-crop='circle' src='{avatar}'/>
return "video"; <text>{title}</text>
case NotificationType.Changelog: <text>{channel} uploaded a new video</text>
return "changelog"; </binding>
default: </visual>
return "internal";
} <actions>
<action content='Add to Watch later' activationType='background' arguments='later-{id}'/>
<action content='Go to channel' activationType='foreground' arguments='channel-{channelId}'/>
</actions>
</toast>");
return new ToastNotification(template);
} }
private NotificationType TypeConversion(string type) public static ToastNotification GetInternalToast(string id, string header, string content, string thumbnail, string avatar)
{ {
switch (type) XmlDocument template = new XmlDocument();
{
case "comment": template.LoadXml($@"<toast activationType='foreground' launch='inbox-{id}'>
return NotificationType.Comment; <visual>
case "post": <binding template='ToastGeneric'>
return NotificationType.Post; <image placement='hero' src='{thumbnail ?? "http://foxgame.hol.es/FoxTubeAssets/AnnouncementThumb.png"}'/>
case "video": <image placement='appLogoOverride' hint-crop='circle' src='{avatar ?? "http://foxgame.hol.es/FoxTubeAssets/LogoAvatar.png"}'/>
return NotificationType.Video; <text>{header}</text>
case "changelog": <text hint-maxLines='5'>{content}</text>
return NotificationType.Changelog; </binding>
default: </visual>
return NotificationType.Internal; </toast>");
}
return new ToastNotification(template);
} }
} }
} }
+15
View File
@@ -0,0 +1,15 @@
<UserControl
x:Class="FoxTube.Controls.Advert"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid>
</Grid>
</UserControl>
+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace FoxTube.Controls
{
public sealed partial class Advert : UserControl
{
public Advert()
{
this.InitializeComponent();
}
}
}
+7
View File
@@ -101,6 +101,9 @@
<Compile Include="Classes\InboxItem.cs" /> <Compile Include="Classes\InboxItem.cs" />
<Compile Include="Classes\Methods.cs" /> <Compile Include="Classes\Methods.cs" />
<Compile Include="Classes\ObjectEventArgs.cs" /> <Compile Include="Classes\ObjectEventArgs.cs" />
<Compile Include="Controls\Advert.xaml.cs">
<DependentUpon>Advert.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ChannelCard.xaml.cs"> <Compile Include="Controls\ChannelCard.xaml.cs">
<DependentUpon>ChannelCard.xaml</DependentUpon> <DependentUpon>ChannelCard.xaml</DependentUpon>
</Compile> </Compile>
@@ -277,6 +280,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Page Include="Controls\Advert.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ChannelCard.xaml"> <Page Include="Controls\ChannelCard.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
+1 -1
View File
@@ -1 +1 @@
<toast launch="action=viewPhoto&amp;photoId=92187"> <toast launch="action=viewPhoto&amp;photoId=92187">
+3 -2
View File
@@ -1,6 +1,7 @@
<posts> <posts>
<post time="YYYY-MM-DDThh:mm:ss-03" image="http://foxtube.hol.es/foxtube/FILE_NAME.png Hero image (not implemented yet)" id="0"> <post time="YYYY-MM-DDThh:mm:ss-03" id="0">
<notificationHeader>Short headline for toast notifications</notificationHeader> <thumbnail></thumbnail>
<avatar></avatar>
<header>Main headline for full post</header> <header>Main headline for full post</header>
<content>Announcement body (beware of special characters)</content> <content>Announcement body (beware of special characters)</content>
</post> </post>
+4 -26
View File
@@ -53,8 +53,8 @@ namespace FoxTube
if (settings.Values["newVideoNotification"] == null) if (settings.Values["newVideoNotification"] == null)
settings.Values.Add("newVideoNotification", true); settings.Values.Add("newVideoNotification", true);
if (settings.Values["newmessagesNotification"] == null) if (settings.Values["devNews"] == null)
settings.Values.Add("newmessagesNotification", true); settings.Values.Add("devNews", true);
if (settings.Values["moblieWarning"] == null) if (settings.Values["moblieWarning"] == null)
settings.Values.Add("moblieWarning", false); settings.Values.Add("moblieWarning", false);
@@ -70,19 +70,11 @@ namespace FoxTube
if (settings.Values["safeSearch"] == null) if (settings.Values["safeSearch"] == null)
settings.Values.Add("safeSearch", 0); settings.Values.Add("safeSearch", 0);
if (settings.Values["notificationsHistory"] == null)
{
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));
doc.AppendChild(doc.CreateElement("history"));
settings.Values.Add("notificationsHistory", doc.InnerXml);
}
PackageVersion ver = Package.Current.Id.Version; PackageVersion ver = Package.Current.Id.Version;
if (settings.Values["ver"] == null) if (settings.Values["ver"] == null)
settings.Values.Add("ver", $"{ver.Major}.{ver.Minor}"); settings.Values.Add("ver", $"{ver.Major}.{ver.Minor}");
if((string)settings.Values["ver"] != $"{ver.Major}.{ver.Minor}") if((string)settings.Values["ver"] == $"{ver.Major}.{ver.Minor}") //Replace for '!=' !!!
{ {
try try
{ {
@@ -90,21 +82,7 @@ namespace FoxTube
changelog.Load("http://foxgame.hol.es/foxtube-changelog.xml"); changelog.Load("http://foxgame.hol.es/foxtube-changelog.xml");
XmlElement e = changelog["items"].ChildNodes[0] as XmlElement; XmlElement e = changelog["items"].ChildNodes[0] as XmlElement;
XmlDocument doc = new XmlDocument(); ToastNotificationManager.CreateToastNotifier().Show(FoxTube.Background.Notification.GetChangelogToast(e.GetAttribute("version")));
doc.LoadXml(settings.Values["notificationsHistory"] as string);
Background.Notification n = new Background.Notification("changelog",
$"changelog-{e.GetAttribute("version").Replace('.', '-')}",
"Changelog",
$"What&apos;s new in version {e.GetAttribute("version")}",
DateTime.Parse(e.GetAttribute("time")),
"http://foxgame.hol.es/FoxTubeAssets/WhatsNewThumb.png",
"http://foxgame.hol.es/FoxTubeAssets/NewsAvatar.png");
doc["history"].InnerXml += n.GetXml();
settings.Values["notificationsHistory"] = doc.InnerXml;
ToastNotificationManager.CreateToastNotifier().Show(n.GetToast());
settings.Values["ver"] = $"{ver.Major}.{ver.Minor}"; settings.Values["ver"] = $"{ver.Major}.{ver.Minor}";
} }
+1
View File
@@ -42,6 +42,7 @@
<TextBlock x:Uid="/General/notifications" Text="Notifications" FontSize="22"/> <TextBlock x:Uid="/General/notifications" Text="Notifications" FontSize="22"/>
<ToggleSwitch x:Uid="/General/newVideo" Name="newVideo" OnContent="Notify when someone of your subscriptions uploaded new video" OffContent="Notify when someone of your subscriptions uploaded new video" Toggled="notification_IsEnabledChanged"/> <ToggleSwitch x:Uid="/General/newVideo" Name="newVideo" OnContent="Notify when someone of your subscriptions uploaded new video" OffContent="Notify when someone of your subscriptions uploaded new video" Toggled="notification_IsEnabledChanged"/>
<ToggleSwitch Name="devNews" OnContent="Recieve messages from developers" OffContent="Recieve messages from developers" Toggled="devNews_Toggled"/>
<TextBlock x:Uid="/General/color" Text="Color mode" FontSize="22"/> <TextBlock x:Uid="/General/color" Text="Color mode" FontSize="22"/>
<RadioButton x:Uid="/General/colorLight" Content="Light" Name="light" GroupName="color" Checked="RadioButton_Checked"/> <RadioButton x:Uid="/General/colorLight" Content="Light" Name="light" GroupName="color" Checked="RadioButton_Checked"/>
@@ -134,5 +134,10 @@ namespace FoxTube.Pages.SettingsPages
{ {
CoreApplication.Exit(); CoreApplication.Exit();
} }
private void devNews_Toggled(object sender, RoutedEventArgs e)
{
settings.Values["devnews"] = devNews.IsOn;
}
} }
} }