diff --git a/FoxTube/Assets/Data/Patchnotes.xml b/FoxTube/Assets/Data/Patchnotes.xml new file mode 100644 index 0000000..d474cca --- /dev/null +++ b/FoxTube/Assets/Data/Patchnotes.xml @@ -0,0 +1,6 @@ + + + + Announcement body (beware of special characters) + + diff --git a/FoxTube/Classes/InboxItem.cs b/FoxTube/Classes/InboxItem.cs new file mode 100644 index 0000000..b1e1dbb --- /dev/null +++ b/FoxTube/Classes/InboxItem.cs @@ -0,0 +1,65 @@ +using System; +using System.Xml; + +namespace FoxTube.Classes +{ + public enum InboxItemType { Default, PatchNote} + + public class InboxItem + { + public InboxItemType Type { get; set; } = InboxItemType.Default; + DateTime TimeStamp { get; set; } + + public string PatchVersion { get; set; } + public string Subject { get; set; } + public string Content { get; set; } + + public string Icon + { + get + { + if (Type == InboxItemType.PatchNote) + return @""; + else + return @""; + } + } + public string Subtitle + { + get + { + if (Type == InboxItemType.PatchNote) + return "Patch note"; + else + return "Developer's message"; + } + } + + public string Title + { + get + { + if (Type == InboxItemType.PatchNote) + return $"What's new in v{PatchVersion}"; + else + return Subject; + } + } + + + public InboxItem(string version, string content, string timeStamp) + { + Type = InboxItemType.PatchNote; + PatchVersion = version; + Content = content; + TimeStamp = XmlConvert.ToDateTime(timeStamp, XmlDateTimeSerializationMode.Unspecified); + } + + public InboxItem(string title, string content, DateTime timeStamp) + { + Type = InboxItemType.Default; + Content = content; + TimeStamp = timeStamp; + } + } +} diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj index cbbab59..f5fc5c3 100644 --- a/FoxTube/FoxTube.csproj +++ b/FoxTube/FoxTube.csproj @@ -96,6 +96,7 @@ App.xaml + @@ -141,6 +142,9 @@ Home.xaml + + Inbox.xaml + LoadingPage.xaml @@ -194,6 +198,7 @@ + @@ -329,6 +334,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/FoxTube/Pages/Inbox.xaml b/FoxTube/Pages/Inbox.xaml new file mode 100644 index 0000000..74287bd --- /dev/null +++ b/FoxTube/Pages/Inbox.xaml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FoxTube/Pages/Inbox.xaml.cs b/FoxTube/Pages/Inbox.xaml.cs new file mode 100644 index 0000000..a046d8c --- /dev/null +++ b/FoxTube/Pages/Inbox.xaml.cs @@ -0,0 +1,57 @@ +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; +using FoxTube.Classes; +using System.Xml; + +// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 + +namespace FoxTube.Pages +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public sealed partial class Inbox : Page + { + List items = new List(); + public Inbox() + { + this.InitializeComponent(); + LoadItems(); + } + + public void LoadItems() + { + XmlDocument doc = new XmlDocument(); + + doc.Load("ms-appx:///Assets/Data/Patchnotes.xml"); + foreach (XmlElement e in doc["items"].ChildNodes) + items.Add(new InboxItem( + e.GetAttribute("version"), + e["content"].InnerText, + e.GetAttribute("time") + )); + + doc.Load("http://foxgame.hol.es/ftp.xml"); + foreach (XmlElement e in doc["items"].ChildNodes) + items.Add(new InboxItem( + e["header"].InnerText, + e["content"].InnerText, + XmlConvert.ToDateTime(e.GetAttribute("time"), XmlDateTimeSerializationMode.Unspecified) + )); + + items.Sort(); + } + } +}