Notification system development 1
This commit is contained in:
@@ -16,7 +16,7 @@ using Windows.UI.Notifications;
|
|||||||
|
|
||||||
namespace FoxTube.Background
|
namespace FoxTube.Background
|
||||||
{
|
{
|
||||||
public delegate void NotificationHandler(object sender, string xml);
|
public delegate void NotificationHandler(object sender, Notification item);
|
||||||
|
|
||||||
public sealed class BackgroundProcessor : IBackgroundTask
|
public sealed class BackgroundProcessor : IBackgroundTask
|
||||||
{
|
{
|
||||||
@@ -45,7 +45,7 @@ namespace FoxTube.Background
|
|||||||
{
|
{
|
||||||
def = taskInstance.GetDeferral();
|
def = taskInstance.GetDeferral();
|
||||||
if (settings.Values["lastCheck"] == null)
|
if (settings.Values["lastCheck"] == null)
|
||||||
settings.Values.Add("lastCheck", XmlConvert.ToString(DateTime.Now));
|
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 (settings.Values["notificationsHistory"] != null)
|
if (settings.Values["notificationsHistory"] != null)
|
||||||
@@ -57,9 +57,6 @@ namespace FoxTube.Background
|
|||||||
settings.Values.Add("notificationsHistory", doc.InnerXml);
|
settings.Values.Add("notificationsHistory", doc.InnerXml);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((bool)settings.Values["authorized"] == true)
|
|
||||||
CheckAccount();
|
|
||||||
|
|
||||||
CheckAnnouncements();
|
CheckAnnouncements();
|
||||||
|
|
||||||
SendNSave();
|
SendNSave();
|
||||||
@@ -114,49 +111,44 @@ namespace FoxTube.Background
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CheckAnnouncements()
|
void CheckAnnouncements()
|
||||||
{
|
{
|
||||||
XmlDocument doc = new XmlDocument();
|
XmlDocument doc = new XmlDocument();
|
||||||
doc.Load(XmlReader.Create("http://foxgame.hol.es/ftp.xml"));
|
doc.Load(XmlReader.Create("http://foxgame.hol.es/foxtube-messages.xml"));
|
||||||
if ((XmlConvert.ToDateTime((doc["posts"].FirstChild as XmlElement).GetAttribute("time"), XmlDateTimeSerializationMode.Utc) - lastCheck.ToUniversalTime()).TotalSeconds > 0)
|
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"),
|
Notifications.Add(new Notification("internal", (doc["posts"].FirstChild as XmlElement).GetAttribute("id"),
|
||||||
doc["posts"].FirstChild["notificationHeader"].InnerText,
|
doc["posts"].FirstChild["notificationHeader"].InnerText,
|
||||||
doc["posts"].FirstChild["content"].InnerText,
|
doc["posts"].FirstChild["content"].InnerText,
|
||||||
XmlConvert.ToDateTime((doc["posts"].FirstChild as XmlElement).GetAttribute("time"),
|
XmlConvert.ToDateTimeOffset((doc["posts"].FirstChild as XmlElement).GetAttribute("time"), "YYYY-MM-DDThh:mm:ss"),
|
||||||
XmlDateTimeSerializationMode.Unspecified),
|
|
||||||
(doc["posts"].FirstChild as XmlElement).GetAttribute("image"), null));
|
(doc["posts"].FirstChild as XmlElement).GetAttribute("image"), null));
|
||||||
|
|
||||||
return doc.InnerXml;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendNotification(Notification notification)
|
void SendNotification(Notification notification)
|
||||||
{
|
{
|
||||||
ToastNotificationManager.CreateToastNotifier().Show(notification.GetToast(0));
|
ToastNotificationManager.CreateToastNotifier().Show(notification.GetToast());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendNSave()
|
void SendNSave()
|
||||||
{
|
{
|
||||||
foreach (Notification n in Notifications)
|
foreach (Notification n in Notifications)
|
||||||
{
|
{
|
||||||
NotificationRecieved.Invoke(this, n.GetXml());
|
NotificationRecieved.Invoke(this, n);
|
||||||
doc["history"].InnerXml += n.GetXml();
|
doc["history"].InnerXml += n.GetXml();
|
||||||
}
|
}
|
||||||
settings.Values.Add("notificationsHistory", doc.InnerXml);
|
settings.Values.Add("notificationsHistory", doc.InnerXml);
|
||||||
|
|
||||||
if ((bool)settings.Values["notifications"])
|
foreach (Notification n in Notifications)
|
||||||
foreach (Notification n in Notifications)
|
switch (n.Type)
|
||||||
switch (n.Type)
|
{
|
||||||
{
|
case NotificationType.Video:
|
||||||
case NotificationType.Video:
|
if ((bool)settings.Values["newVideoNotification"])
|
||||||
if ((bool)settings.Values["newVideoNotification"])
|
SendNotification(n);
|
||||||
SendNotification(n);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case NotificationType.Internal:
|
case NotificationType.Internal:
|
||||||
if ((bool)settings.Values["newmessagesNotification"])
|
SendNotification(n);
|
||||||
SendNotification(n);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace FoxTube.Background
|
|||||||
{
|
{
|
||||||
public enum NotificationType
|
public enum NotificationType
|
||||||
{
|
{
|
||||||
Video, Comment, Post, Internal
|
Video, Comment, Post, Internal, Changelog
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class Notification
|
public sealed class Notification
|
||||||
@@ -35,6 +35,7 @@ namespace FoxTube.Background
|
|||||||
Channel = channelName;
|
Channel = channelName;
|
||||||
Content = content;
|
Content = content;
|
||||||
TimeStamp = date;
|
TimeStamp = date;
|
||||||
|
Id = id;
|
||||||
Type = TypeConversion(type);
|
Type = TypeConversion(type);
|
||||||
Avatar = avatarUrl == null? "ms-appx:///Assets/Icons/Profile.png" : avatarUrl;
|
Avatar = avatarUrl == null? "ms-appx:///Assets/Icons/Profile.png" : avatarUrl;
|
||||||
Thumbnail = thumbnailUrl;
|
Thumbnail = thumbnailUrl;
|
||||||
@@ -136,13 +137,13 @@ namespace FoxTube.Background
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToastNotification GetToast(int assignedId)
|
public ToastNotification GetToast()
|
||||||
{
|
{
|
||||||
XmlDocument template = new XmlDocument();
|
XmlDocument template = new XmlDocument();
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case NotificationType.Comment:
|
case NotificationType.Comment:
|
||||||
template.LoadXml($@"<toast launch='type=comment&action=open&id={assignedId}'>
|
template.LoadXml($@"<toast launch='comment&{Id}'>
|
||||||
<visual>
|
<visual>
|
||||||
<binding template='ToastGeneric'>
|
<binding template='ToastGeneric'>
|
||||||
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
|
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
|
||||||
@@ -156,16 +157,16 @@ namespace FoxTube.Background
|
|||||||
|
|
||||||
<action content='Send' imageUri='Assets/Icons/Send.png'
|
<action content='Send' imageUri='Assets/Icons/Send.png'
|
||||||
hint-inputId='textBox' activationType='background'
|
hint-inputId='textBox' activationType='background'
|
||||||
arguments='type=comment&action=sendReply&id={assignedId}'/>
|
arguments='comment&{Id}&send'/>
|
||||||
|
|
||||||
<action content='Like'
|
<action content='Like'
|
||||||
arguments='type=comment&action=like&id={assignedId}'/>
|
arguments='comment&{Id}&like'/>
|
||||||
</actions>
|
</actions>
|
||||||
</toast>");
|
</toast>");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NotificationType.Video:
|
case NotificationType.Video:
|
||||||
template.LoadXml($@"<toast launch='action=viewPhoto&photoId=92187'>
|
template.LoadXml($@"<toast launch='video&{Id}'>
|
||||||
<visual>
|
<visual>
|
||||||
<binding template='ToastGeneric'>
|
<binding template='ToastGeneric'>
|
||||||
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
|
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
|
||||||
@@ -178,16 +179,29 @@ namespace FoxTube.Background
|
|||||||
<actions>
|
<actions>
|
||||||
<action content='Watch later'
|
<action content='Watch later'
|
||||||
activationType='background'
|
activationType='background'
|
||||||
arguments='likePhoto&photoId=92187'/>
|
arguments='video&{Id}&later'/>
|
||||||
<action content='Go to channel'
|
<action content='Go to channel'
|
||||||
arguments='action=commentPhoto&photoId=92187'/>
|
arguments='video&{Id}&channel'/>
|
||||||
</actions>
|
</actions>
|
||||||
</toast>");
|
</toast>");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case NotificationType.Changelog:
|
||||||
|
template.LoadXml($@"<toast launch='changelog&{Id}'>
|
||||||
|
<visual>
|
||||||
|
<binding template='ToastGeneric'>
|
||||||
|
<image placement='hero' src='Assets/WhatsNewThumb.png'/>
|
||||||
|
<image placement='appLogoOverride' hint-crop='circle' src='Assets/LogoAvatar.png'/>
|
||||||
|
<text>{Content}</text>
|
||||||
|
<text>Changelog</text>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
</toast>");
|
||||||
|
break;
|
||||||
|
|
||||||
case NotificationType.Internal:
|
case NotificationType.Internal:
|
||||||
string thumb1 = string.IsNullOrWhiteSpace(Thumbnail) ? "Assets/AnnouncementThumb.png" : Thumbnail;
|
string thumb1 = string.IsNullOrWhiteSpace(Thumbnail) ? "Assets/AnnouncementThumb.png" : Thumbnail;
|
||||||
template.LoadXml($@"<toast launch='action=openThread&threadId=92187'>
|
template.LoadXml($@"<toast launch='internal&{Id}'>
|
||||||
<visual>
|
<visual>
|
||||||
<binding template='ToastGeneric'>
|
<binding template='ToastGeneric'>
|
||||||
<image placement='hero' src='{thumb1}'/>
|
<image placement='hero' src='{thumb1}'/>
|
||||||
@@ -199,9 +213,9 @@ namespace FoxTube.Background
|
|||||||
|
|
||||||
<actions>
|
<actions>
|
||||||
<action content='Watch full post'
|
<action content='Watch full post'
|
||||||
arguments='action=commentPhoto&photoId=92187'/>
|
arguments='internal&{Id}'/>
|
||||||
<action content='Manage notifications'
|
<action content='Manage notifications'
|
||||||
arguments='action=commentPhoto&photoId=92187'/>
|
arguments='notifications'/>
|
||||||
</actions>
|
</actions>
|
||||||
</toast>");
|
</toast>");
|
||||||
break;
|
break;
|
||||||
@@ -246,6 +260,8 @@ namespace FoxTube.Background
|
|||||||
return "post";
|
return "post";
|
||||||
case NotificationType.Video:
|
case NotificationType.Video:
|
||||||
return "video";
|
return "video";
|
||||||
|
case NotificationType.Changelog:
|
||||||
|
return "changelog";
|
||||||
default:
|
default:
|
||||||
return "internal";
|
return "internal";
|
||||||
}
|
}
|
||||||
@@ -261,6 +277,8 @@ namespace FoxTube.Background
|
|||||||
return NotificationType.Post;
|
return NotificationType.Post;
|
||||||
case "video":
|
case "video":
|
||||||
return NotificationType.Video;
|
return NotificationType.Video;
|
||||||
|
case "changelog":
|
||||||
|
return NotificationType.Changelog;
|
||||||
default:
|
default:
|
||||||
return NotificationType.Internal;
|
return NotificationType.Internal;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace FoxTube.Classes
|
|||||||
public string PatchVersion { get; set; }
|
public string PatchVersion { get; set; }
|
||||||
public string Subject { get; set; }
|
public string Subject { get; set; }
|
||||||
public string Content { get; set; }
|
public string Content { get; set; }
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
public string Icon
|
public string Icon
|
||||||
{
|
{
|
||||||
@@ -47,20 +48,22 @@ namespace FoxTube.Classes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public InboxItem(string version, string content, string timeStamp)
|
public InboxItem(string version, string content, string timeStamp, string id)
|
||||||
{
|
{
|
||||||
Type = InboxItemType.PatchNote;
|
Type = InboxItemType.PatchNote;
|
||||||
PatchVersion = version;
|
PatchVersion = version;
|
||||||
Content = content;
|
Content = content;
|
||||||
TimeStamp = DateTime.Parse(timeStamp);
|
TimeStamp = DateTime.Parse(timeStamp);
|
||||||
|
Id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InboxItem(string title, string content, DateTime timeStamp)
|
public InboxItem(string title, string content, DateTime timeStamp, string id)
|
||||||
{
|
{
|
||||||
Type = InboxItemType.Default;
|
Type = InboxItemType.Default;
|
||||||
Content = content;
|
Content = content;
|
||||||
Subject = title;
|
Subject = title;
|
||||||
TimeStamp = timeStamp;
|
TimeStamp = timeStamp;
|
||||||
|
Id = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,11 +111,19 @@ namespace FoxTube
|
|||||||
|
|
||||||
public static async void Authorize()
|
public static async void Authorize()
|
||||||
{
|
{
|
||||||
try { Credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(Secrets, new[] { Google.Apis.Oauth2.v2.Oauth2Service.Scope.UserinfoProfile, YouTubeService.Scope.YoutubeForceSsl }, "user", CancellationToken.None); }
|
try
|
||||||
catch { }
|
|
||||||
if(Credential != null)
|
|
||||||
{
|
{
|
||||||
try
|
Credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
|
||||||
|
Secrets,
|
||||||
|
new[]
|
||||||
|
{
|
||||||
|
Google.Apis.Oauth2.v2.Oauth2Service.Scope.UserinfoProfile,
|
||||||
|
YouTubeService.Scope.YoutubeForceSsl
|
||||||
|
},
|
||||||
|
"user",
|
||||||
|
CancellationToken.None);
|
||||||
|
|
||||||
|
if (Credential != null)
|
||||||
{
|
{
|
||||||
if (settings.Values["authorized"] == null)
|
if (settings.Values["authorized"] == null)
|
||||||
settings.Values.Add("authorized", true);
|
settings.Values.Add("authorized", true);
|
||||||
@@ -174,27 +182,27 @@ namespace FoxTube
|
|||||||
Subscriptions.Add(s);
|
Subscriptions.Add(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{
|
|
||||||
MessageDialog dialog = new MessageDialog("We were unabled to retrieve your account information due to weak internet connection or Google servers' problems. PLease, try again later", "Failed to connect");
|
|
||||||
|
|
||||||
dialog.Commands.Add(new UICommand("Try again", (command) =>
|
|
||||||
{
|
|
||||||
Authorize();
|
|
||||||
}));
|
|
||||||
dialog.Commands.Add(new UICommand("Quit", (command) =>
|
|
||||||
{
|
|
||||||
Methods.CloseApp();
|
|
||||||
}));
|
|
||||||
dialog.Commands.Add(new UICommand("Close"));
|
|
||||||
|
|
||||||
await dialog.ShowAsync();
|
|
||||||
|
|
||||||
IsAuthorized = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
AuthorizationStateChanged.Invoke(null, null);
|
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
MessageDialog dialog = new MessageDialog("We were unabled to retrieve your account information due to weak internet connection or Google servers' problems. PLease, try again later", "Failed to connect");
|
||||||
|
|
||||||
|
dialog.Commands.Add(new UICommand("Try again", (command) =>
|
||||||
|
{
|
||||||
|
Authorize();
|
||||||
|
}));
|
||||||
|
dialog.Commands.Add(new UICommand("Quit", (command) =>
|
||||||
|
{
|
||||||
|
Methods.CloseApp();
|
||||||
|
}));
|
||||||
|
dialog.Commands.Add(new UICommand("Close"));
|
||||||
|
|
||||||
|
await dialog.ShowAsync();
|
||||||
|
|
||||||
|
IsAuthorized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
AuthorizationStateChanged.Invoke(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async void Deauthenticate()
|
public static async void Deauthenticate()
|
||||||
|
|||||||
@@ -6,17 +6,14 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="400"
|
||||||
d:DesignWidth="350">
|
d:DesignWidth="300">
|
||||||
|
|
||||||
|
|
||||||
<StackPanel Background="WhiteSmoke" Padding="0,10,0,0">
|
<StackPanel Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" Width="300" Margin="-10" MinHeight="400">
|
||||||
<Grid>
|
<Grid Height="50">
|
||||||
<TextBlock Text="Notifications" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
<TextBlock Text="Notifications" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
<Button Visibility="Collapsed" Background="Transparent" Foreground="Gray" FontFamily="Segoe MDL2 Assets" Content="" Height="50" Width="50" HorizontalAlignment="Right" ToolTipService.ToolTip="Clear all" Name="clear" Click="clear_Click"/>
|
||||||
<Button Visibility="Collapsed" Background="Transparent" Foreground="Gray" FontFamily="Segoe MDL2 Assets" Content="" Height="50" Width="50" ToolTipService.ToolTip="Clear all" Name="clear" Click="clear_Click"/>
|
|
||||||
<Button Background="Transparent" Foreground="Gray" FontFamily="Segoe MDL2 Assets" Content="" Height="50" Width="50" ToolTipService.ToolTip="Close" Name="close" Click="close_Click"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock Text="You have no any notification" Name="noNotifications" Foreground="Gray" FontStyle="Italic" Padding="10" Visibility="Visible"/>
|
<TextBlock Text="You have no any notification" Name="noNotifications" Foreground="Gray" FontStyle="Italic" Padding="10" Visibility="Visible"/>
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
|
|||||||
@@ -32,11 +32,14 @@ namespace FoxTube
|
|||||||
public NotificationsCenter()
|
public NotificationsCenter()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
if (settings.Values["notificationsHistory"] != null)
|
if (settings.Values["notificationsHistory"] != null)
|
||||||
{
|
{
|
||||||
doc.LoadXml(settings.Values["notificationsHistory"] as string);
|
doc.LoadXml(settings.Values["notificationsHistory"] as string);
|
||||||
foreach(XmlElement n in doc["history"].ChildNodes)
|
foreach (XmlElement n in doc["history"].ChildNodes)
|
||||||
{
|
{
|
||||||
AddNotification(new Notification(
|
AddNotification(new Notification(
|
||||||
n.GetAttribute("type"),
|
n.GetAttribute("type"),
|
||||||
@@ -59,33 +62,21 @@ namespace FoxTube
|
|||||||
BackgroundProcessor.NotificationRecieved += NewNotification;
|
BackgroundProcessor.NotificationRecieved += NewNotification;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NewNotification(object sender, string xml)
|
private void NewNotification(object sender, Notification item)
|
||||||
{
|
{
|
||||||
XmlElement n = new XmlDocument().CreateElement("item");
|
AddNotification(item);
|
||||||
AddNotification(new Notification(
|
|
||||||
n.GetAttribute("type"),
|
|
||||||
n.GetAttribute("id"),
|
|
||||||
n["channelName"].InnerText,
|
|
||||||
n["content"].InnerText,
|
|
||||||
XmlConvert.ToDateTime(n.GetAttribute("time"), "YYYY-MM-DDThh:mm:ss"),
|
|
||||||
n["images"].GetAttribute("thumbnail"),
|
|
||||||
n["images"].GetAttribute("avatar")
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clear_Click(object sender, RoutedEventArgs e)
|
private void clear_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
array.Children.Clear();
|
array.Children.Clear();
|
||||||
notifications.Clear();
|
notifications.Clear();
|
||||||
|
doc["history"].InnerXml = "";
|
||||||
|
settings.Values["notificationsHistory"] = doc.InnerXml;
|
||||||
clear.Visibility = Visibility.Collapsed;
|
clear.Visibility = Visibility.Collapsed;
|
||||||
noNotifications.Visibility = Visibility.Visible;
|
noNotifications.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void close_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Methods.MainPage.notificationMenu_Click(this, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddNotification(Notification notification)
|
public void AddNotification(Notification notification)
|
||||||
{
|
{
|
||||||
notifications.Add(notification);
|
notifications.Add(notification);
|
||||||
@@ -101,7 +92,7 @@ namespace FoxTube
|
|||||||
|
|
||||||
private void Notification_Click(object sender, RoutedEventArgs e)
|
private void Notification_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Notification n = notifications[((sender as Button).Parent as StackPanel).Children.IndexOf(sender as Button)];
|
Notification n = notifications[array.Children.IndexOf(sender as Button)];
|
||||||
switch(n.Type)
|
switch(n.Type)
|
||||||
{
|
{
|
||||||
case NotificationType.Internal:
|
case NotificationType.Internal:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<history>
|
<history>
|
||||||
<item time="YYYY-MM-DDThh:mm:ss" type="" id="">
|
<item time="YYYY-MM-DDThh:mm:ss-03" type="" id="">
|
||||||
<images thumbnail="" avatar=""/>
|
<images thumbnail="" avatar=""/>
|
||||||
<channelName></channelName>
|
<channelName></channelName>
|
||||||
<content></content>
|
<content></content>
|
||||||
|
|||||||
@@ -52,16 +52,20 @@
|
|||||||
</NavigationView.AutoSuggestBox>
|
</NavigationView.AutoSuggestBox>
|
||||||
|
|
||||||
<NavigationView.Header>
|
<NavigationView.Header>
|
||||||
<Grid Margin="10,10,0,0">
|
<Grid Margin="10,-5,0,-11">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock FontSize="28" VerticalAlignment="Center" Text="Home" Name="header"/>
|
<TextBlock FontSize="28" VerticalAlignment="Center" Text="Home" Name="header"/>
|
||||||
<StackPanel Orientation="Horizontal" Grid.Column="1" Margin="0,17,0,0">
|
<StackPanel Orientation="Horizontal" Grid.Column="1">
|
||||||
<Button Name="notificationMenu" ToolTipService.ToolTip="Notifications" Click="notificationMenu_Click"
|
<Button Name="notificationMenu" ToolTipService.ToolTip="Notifications" Click="notificationMenu_Click"
|
||||||
FontFamily="Segoe MDL2 Assets" Content=""
|
FontFamily="Segoe MDL2 Assets" Content=""
|
||||||
Width="50" Height="50" Background="Transparent"/>
|
Width="50" Height="50" Background="Transparent">
|
||||||
|
<Button.Flyout>
|
||||||
|
<Flyout Content="{x:Bind notificationsCenter}"/>
|
||||||
|
</Button.Flyout>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Button Name="account" ToolTipService.ToolTip="Sign in"
|
<Button Name="account" ToolTipService.ToolTip="Sign in"
|
||||||
FontFamily="Segoe MDL2 Assets" Content=""
|
FontFamily="Segoe MDL2 Assets" Content=""
|
||||||
|
|||||||
+137
-23
@@ -39,6 +39,7 @@ using Google.Apis.Oauth2.v2.Data;
|
|||||||
using FoxTube.Controls;
|
using FoxTube.Controls;
|
||||||
using FoxTube.Pages;
|
using FoxTube.Pages;
|
||||||
using Microsoft.Toolkit.Uwp.UI.Controls;
|
using Microsoft.Toolkit.Uwp.UI.Controls;
|
||||||
|
using Windows.ApplicationModel;
|
||||||
|
|
||||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||||
|
|
||||||
@@ -89,6 +90,40 @@ namespace FoxTube
|
|||||||
if (settings.Values["defaultDownload"] == null)
|
if (settings.Values["defaultDownload"] == null)
|
||||||
settings.Values.Add("defaultDownload", Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\DownloadedVideos");
|
settings.Values.Add("defaultDownload", Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\DownloadedVideos");
|
||||||
|
|
||||||
|
PackageVersion ver = Package.Current.Id.Version;
|
||||||
|
if (settings.Values["ver"] == null)
|
||||||
|
settings.Values.Add("var", $"{ver.Major}.{ver.Minor}");
|
||||||
|
|
||||||
|
if((string)settings.Values["ver"] != $"{ver.Major}.{ver.Minor}")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
XmlDocument changelog = new XmlDocument();
|
||||||
|
changelog.Load("http://foxgame.hol.es/foxtube-changelog.xml");
|
||||||
|
XmlElement e = changelog["items"].ChildNodes[0] as XmlElement;
|
||||||
|
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
doc.LoadXml(settings.Values["notificationsHistory"] as string);
|
||||||
|
|
||||||
|
Background.Notification n = new Background.Notification("changelog",
|
||||||
|
$"changelog-{e.GetAttribute("version")}",
|
||||||
|
"Changelog",
|
||||||
|
$"What's new in version {e.GetAttribute("version")}",
|
||||||
|
XmlConvert.ToDateTimeOffset(e.GetAttribute("time"), "YYYY-MM-DDThh:mm:ss"),
|
||||||
|
"",
|
||||||
|
"");
|
||||||
|
|
||||||
|
doc["history"].InnerXml += n.GetXml();
|
||||||
|
settings.Values["notificationsHistory"] = doc.InnerXml;
|
||||||
|
|
||||||
|
ToastNotificationManager.CreateToastNotifier().Show(n.GetToast());
|
||||||
|
|
||||||
|
settings.Values["ver"] = $"{ver.Major}.{ver.Minor}";
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
notificationsCenter.Initialize();
|
||||||
|
|
||||||
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
|
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
|
||||||
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
|
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
|
||||||
}
|
}
|
||||||
@@ -284,7 +319,7 @@ namespace FoxTube
|
|||||||
public void GoToDeveloper(string id)
|
public void GoToDeveloper(string id)
|
||||||
{
|
{
|
||||||
MinimizeAsInitializer();
|
MinimizeAsInitializer();
|
||||||
content.Navigate(typeof(Settings), "inbox");
|
content.Navigate(typeof(Settings), $"inbox&{id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoToPlaylist(string id)
|
public void GoToPlaylist(string id)
|
||||||
@@ -375,15 +410,22 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
if(search.Text.Length > 2)
|
if(search.Text.Length > 2)
|
||||||
{
|
{
|
||||||
XmlDocument doc = new XmlDocument();
|
try
|
||||||
doc.Load($"http://suggestqueries.google.com/complete/search?output=toolbar&hl={(settings.Values["region"] as string).Remove(2)}&q={search.Text}");
|
{
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
doc.Load($"http://suggestqueries.google.com/complete/search?output=toolbar&hl={(settings.Values["region"] as string).Remove(2)}&q={search.Text}");
|
||||||
|
|
||||||
List<string> suggestions = new List<string>();
|
List<string> suggestions = new List<string>();
|
||||||
|
|
||||||
for (int i = 0; i < doc["toplevel"].ChildNodes.Count && i < 5; i++)
|
for (int i = 0; i < doc["toplevel"].ChildNodes.Count && i < 5; i++)
|
||||||
suggestions.Add(doc["toplevel"].ChildNodes[i]["suggestion"].GetAttribute("data"));
|
suggestions.Add(doc["toplevel"].ChildNodes[i]["suggestion"].GetAttribute("data"));
|
||||||
|
|
||||||
search.ItemsSource = suggestions;
|
search.ItemsSource = suggestions;
|
||||||
|
}
|
||||||
|
catch (System.Net.WebException)
|
||||||
|
{
|
||||||
|
search.ItemsSource = new List<string>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,7 +456,7 @@ namespace FoxTube
|
|||||||
content.Navigate(typeof(ChannelPage), SecretsVault.Subscriptions[Convert.ToInt32((args.SelectedItem as NavigationViewItem).Name)].Snippet.ResourceId.ChannelId);
|
content.Navigate(typeof(ChannelPage), SecretsVault.Subscriptions[Convert.ToInt32((args.SelectedItem as NavigationViewItem).Name)].Snippet.ResourceId.ChannelId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (s == Sender.Frame)
|
else
|
||||||
s = Sender.None;
|
s = Sender.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,25 +482,98 @@ namespace FoxTube
|
|||||||
|
|
||||||
Dictionary<Type, Action> navCase = new Dictionary<Type, Action>()
|
Dictionary<Type, Action> navCase = new Dictionary<Type, Action>()
|
||||||
{
|
{
|
||||||
{ typeof(Settings), () => nav.SelectedItem = nav.SettingsItem },
|
{ typeof(Settings), () =>
|
||||||
|
{
|
||||||
|
if(nav.SelectedItem != nav.SettingsItem)
|
||||||
|
nav.SelectedItem = nav.SettingsItem;
|
||||||
|
else
|
||||||
|
s = Sender.None;
|
||||||
|
|
||||||
|
} },
|
||||||
{ typeof(ChannelPage), () =>
|
{ typeof(ChannelPage), () =>
|
||||||
{
|
{
|
||||||
//Check channel
|
if((content.Content as ChannelPage).channelId == SecretsVault.AccountId)
|
||||||
|
{
|
||||||
|
if(nav.SelectedItem != toChannel)
|
||||||
|
nav.SelectedItem = toChannel;
|
||||||
|
else
|
||||||
|
s = Sender.None;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool b = false;
|
||||||
|
for(int k = 0; k < SecretsVault.Subscriptions.Count && k < 10; k++)
|
||||||
|
if(SecretsVault.Subscriptions[k].Snippet.ResourceId.ChannelId == (content.Content as ChannelPage).channelId)
|
||||||
|
{
|
||||||
|
if(nav.SelectedItem != nav.MenuItems[k + 9])
|
||||||
|
nav.SelectedItem = nav.MenuItems[k + 9];
|
||||||
|
else
|
||||||
|
s = Sender.None;
|
||||||
|
b = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!b)
|
||||||
|
{
|
||||||
|
nav.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
} },
|
} },
|
||||||
{ typeof(PlaylistPage), () =>
|
{ typeof(PlaylistPage), () =>
|
||||||
{
|
{
|
||||||
//Check playlist
|
if((content.Content as PlaylistPage).playlistId == SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes)
|
||||||
|
{
|
||||||
|
if(nav.SelectedItem != toLiked)
|
||||||
|
nav.SelectedItem = toLiked;
|
||||||
|
else
|
||||||
|
s = Sender.None;
|
||||||
|
}
|
||||||
|
else if ((content.Content as PlaylistPage).playlistId == SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater)
|
||||||
|
{
|
||||||
|
if(nav.SelectedItem != toLater)
|
||||||
|
nav.SelectedItem = toLater;
|
||||||
|
else
|
||||||
|
s = Sender.None;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nav.SelectedItem = null;
|
||||||
|
}
|
||||||
} },
|
} },
|
||||||
{ typeof(Search), () => nav.SelectedItem = null },
|
{ typeof(Search), () =>
|
||||||
{ typeof(History), () => nav.SelectedItem = toHistory },
|
{
|
||||||
{ typeof(Home), () => nav.SelectedItem = toHome },
|
nav.SelectedItem = null;
|
||||||
{ typeof(Downloads), () => nav.SelectedItem = toDownloads }
|
} },
|
||||||
|
{ typeof(History), () =>
|
||||||
|
{
|
||||||
|
if(nav.SelectedItem != toHistory)
|
||||||
|
nav.SelectedItem = toHistory;
|
||||||
|
else
|
||||||
|
s = Sender.None;
|
||||||
|
} },
|
||||||
|
{ typeof(Home), () =>
|
||||||
|
{
|
||||||
|
if(nav.SelectedItem != toHome)
|
||||||
|
nav.SelectedItem = toHome;
|
||||||
|
else
|
||||||
|
s = Sender.None;
|
||||||
|
} },
|
||||||
|
{ typeof(Downloads), () =>
|
||||||
|
{
|
||||||
|
if(nav.SelectedItem != toDownloads)
|
||||||
|
nav.SelectedItem = toDownloads;
|
||||||
|
else
|
||||||
|
s = Sender.None;
|
||||||
|
} }
|
||||||
};
|
};
|
||||||
|
|
||||||
try { navCase[e.SourcePageType](); }
|
try { navCase[e.SourcePageType](); }
|
||||||
catch { }
|
catch
|
||||||
|
{
|
||||||
|
nav.SelectedItem = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (s == Sender.Menu)
|
else
|
||||||
s = Sender.None;
|
s = Sender.None;
|
||||||
|
|
||||||
if (content.CanGoBack)
|
if (content.CanGoBack)
|
||||||
@@ -466,13 +581,17 @@ namespace FoxTube
|
|||||||
else
|
else
|
||||||
nav.IsBackEnabled = false;
|
nav.IsBackEnabled = false;
|
||||||
|
|
||||||
|
if ((e.SourcePageType == typeof(Home) || e.SourcePageType == typeof(Settings)) && nav.DisplayMode == NavigationViewDisplayMode.Expanded)
|
||||||
|
nav.IsPaneOpen = true;
|
||||||
|
else
|
||||||
|
nav.IsPaneOpen = false;
|
||||||
|
|
||||||
if (videoPlaceholder.Content != null && (videoPlaceholder.Parent as DropShadowPanel).HorizontalAlignment == HorizontalAlignment.Stretch)
|
if (videoPlaceholder.Content != null && (videoPlaceholder.Parent as DropShadowPanel).HorizontalAlignment == HorizontalAlignment.Stretch)
|
||||||
MinimizeAsInitializer();
|
MinimizeAsInitializer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toChannel_Click(object sender, RoutedEventArgs e)
|
private void toChannel_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
nav.SelectedItem = null;
|
|
||||||
GoToChannel(SecretsVault.UserChannel.Id);
|
GoToChannel(SecretsVault.UserChannel.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,10 +608,5 @@ namespace FoxTube
|
|||||||
else
|
else
|
||||||
content.GoBack();
|
content.GoBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseApp()
|
|
||||||
{
|
|
||||||
CoreApplication.Exit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace FoxTube.Pages
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class PlaylistPage : Page
|
public sealed partial class PlaylistPage : Page
|
||||||
{
|
{
|
||||||
string playlistId;
|
public string playlistId;
|
||||||
Playlist item;
|
Playlist item;
|
||||||
|
|
||||||
LoadingPage loading;
|
LoadingPage loading;
|
||||||
|
|||||||
@@ -42,9 +42,13 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
pivot.SelectedIndex = 1;
|
pivot.SelectedIndex = 1;
|
||||||
if ((string)e.Parameter != "feedback")
|
if ((string)e.Parameter != "feedback")
|
||||||
{
|
((pivot.SelectedItem as PivotItem).Content as Feedback).PreDefine(Convert.ToBoolean((e.Parameter as string).Split('&', '=')[2]), (e.Parameter as string).Split('&', '=')[4]);
|
||||||
((pivot.Items[1] as PivotItem).Content as Feedback).PreDefine(Convert.ToBoolean((e.Parameter as string).Split('&', '=')[2]), (e.Parameter as string).Split('&', '=')[4]);
|
}
|
||||||
}
|
else if ((e.Parameter as string).Contains("inbox"))
|
||||||
|
{
|
||||||
|
pivot.SelectedIndex = 4;
|
||||||
|
if ((string)e.Parameter != "inbox")
|
||||||
|
((pivot.SelectedItem as PivotItem).Content as Inbox).Open((e.Parameter as string).Split('&')[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
switch(e.Parameter as string)
|
switch(e.Parameter as string)
|
||||||
@@ -55,9 +59,6 @@ namespace FoxTube
|
|||||||
case "translate":
|
case "translate":
|
||||||
pivot.SelectedIndex = 3;
|
pivot.SelectedIndex = 3;
|
||||||
break;
|
break;
|
||||||
case "inbox":
|
|
||||||
pivot.SelectedIndex = 4;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,14 +53,14 @@
|
|||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="0"/>
|
<ColumnDefinition Width="0"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ScrollViewer>
|
<ScrollViewer Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}">
|
||||||
<StackPanel VerticalAlignment="Stretch">
|
<StackPanel VerticalAlignment="Stretch">
|
||||||
<ComboBox Header="Filter" Margin="10" HorizontalAlignment="Stretch" SelectedIndex="0" Name="filter" SelectionChanged="filter_SelectionChanged">
|
<ComboBox Header="Filter" Margin="10" HorizontalAlignment="Stretch" SelectedIndex="0" Name="filter" SelectionChanged="filter_SelectionChanged">
|
||||||
<ComboBoxItem Content="All"/>
|
<ComboBoxItem Content="All"/>
|
||||||
<ComboBoxItem Content="Messages"/>
|
<ComboBoxItem Content="Messages"/>
|
||||||
<ComboBoxItem Content="Patch notes"/>
|
<ComboBoxItem Content="Patch notes"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<ListBox Name="list" SelectionChanged="list_SelectionChanged">
|
<ListBox Name="list" SelectionChanged="list_SelectionChanged" Background="Transparent">
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem">
|
<Style TargetType="ListBoxItem">
|
||||||
<Setter Property="Padding" Value="10"/>
|
<Setter Property="Padding" Value="10"/>
|
||||||
@@ -72,18 +72,18 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="auto"/>
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid Margin="0,0,10,0">
|
<Grid Margin="0,0,10,0">
|
||||||
<Ellipse Fill="Red" Height="40" Width="40"/>
|
<Ellipse Fill="Red" Height="40" Width="40"/>
|
||||||
<TextBlock Foreground="White" FontFamily="Segoe MDL2 Assets" Text="{Binding Path=Icon}" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Light" FontSize="17"/>
|
<TextBlock Foreground="White" FontFamily="Segoe MDL2 Assets" Text="{Binding Path=Icon}" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Light" FontSize="17"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<TextBlock FontWeight="Bold" Text="{Binding Path=Title}"/>
|
<TextBlock FontWeight="Bold" Text="{Binding Path=Title}" MaxLines="1" TextWrapping="Wrap"/>
|
||||||
<TextBlock Foreground="Gray" Text="{Binding Path=Subtitle}"/>
|
<TextBlock Opacity=".5" Text="{Binding Path=Subtitle}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock Foreground="Gray" FontSize="13" Text="{Binding Path=TimeStamp}" Grid.Column="2"/>
|
<TextBlock Opacity=".5" FontSize="13" Text="{Binding Path=TimeStamp}" Grid.Column="2" TextWrapping="WrapWholeWords"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using FoxTube.Classes;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using Windows.UI.Popups;
|
||||||
|
|
||||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||||
|
|
||||||
@@ -26,7 +27,6 @@ namespace FoxTube.Pages.SettingsPages
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class Inbox : Page
|
public sealed partial class Inbox : Page
|
||||||
{
|
{
|
||||||
public bool Loaded = false;
|
|
||||||
List<InboxItem> backup = new List<InboxItem>();
|
List<InboxItem> backup = new List<InboxItem>();
|
||||||
List<InboxItem> items = new List<InboxItem>();
|
List<InboxItem> items = new List<InboxItem>();
|
||||||
public Inbox()
|
public Inbox()
|
||||||
@@ -34,35 +34,36 @@ namespace FoxTube.Pages.SettingsPages
|
|||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void LoadItems()
|
public void LoadItems()
|
||||||
{
|
{
|
||||||
XmlDocument doc = new XmlDocument();
|
try
|
||||||
|
{
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
|
||||||
string path = @"Assets\Data\Patchnotes.xml";
|
doc.Load("http://foxgame.hol.es/foxtube-changelog.xml");
|
||||||
StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
|
foreach (XmlElement e in doc["items"].ChildNodes)
|
||||||
StorageFile file = await InstallationFolder.GetFileAsync(path);
|
items.Add(new InboxItem(
|
||||||
Stream Countries = await file.OpenStreamForReadAsync();
|
e.GetAttribute("version"),
|
||||||
|
e["content"].InnerText,
|
||||||
|
e.GetAttribute("time"),
|
||||||
|
e.GetAttribute("id")
|
||||||
|
));
|
||||||
|
|
||||||
doc.Load(Countries);
|
doc.Load("http://foxgame.hol.es/foxtube-messages.xml");
|
||||||
foreach (XmlElement e in doc["items"].ChildNodes)
|
foreach (XmlElement e in doc["posts"].ChildNodes)
|
||||||
items.Add(new InboxItem(
|
items.Add(new InboxItem(
|
||||||
e.GetAttribute("version"),
|
e["header"].InnerText,
|
||||||
e["content"].InnerText,
|
e["content"].InnerText,
|
||||||
e.GetAttribute("time")
|
DateTime.Parse(e.GetAttribute("time")),
|
||||||
));
|
e.GetAttribute("id")
|
||||||
|
));
|
||||||
|
|
||||||
doc.Load("http://foxgame.hol.es/ftp.xml");
|
items.OrderBy(item => item.TimeStamp);
|
||||||
foreach (XmlElement e in doc["posts"].ChildNodes)
|
|
||||||
items.Add(new InboxItem(
|
|
||||||
e["header"].InnerText,
|
|
||||||
e["content"].InnerText,
|
|
||||||
DateTime.Parse(e.GetAttribute("time"))
|
|
||||||
));
|
|
||||||
|
|
||||||
items.OrderBy(item => item.TimeStamp);
|
foreach (InboxItem i in items)
|
||||||
|
backup.Add(i);
|
||||||
foreach (InboxItem i in items)
|
}
|
||||||
backup.Add(i);
|
catch { }
|
||||||
|
|
||||||
list.ItemsSource = items;
|
list.ItemsSource = items;
|
||||||
}
|
}
|
||||||
@@ -138,5 +139,12 @@ namespace FoxTube.Pages.SettingsPages
|
|||||||
Debug.WriteLine("Closed");
|
Debug.WriteLine("Closed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Open(string id)
|
||||||
|
{
|
||||||
|
InboxItem item = items.Find(x => x.Id == id);
|
||||||
|
if(item != null)
|
||||||
|
list.SelectedIndex = items.IndexOf(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user