Inbox development 1
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<items>
|
||||
<item time="YYYY-MM-DDThh:mm:ss-03" version="1.0.1">
|
||||
<content>Announcement body (beware of special characters)</content>
|
||||
</item>
|
||||
</items>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,6 +96,7 @@
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Classes\InboxItem.cs" />
|
||||
<Compile Include="Classes\Methods.cs" />
|
||||
<Compile Include="Classes\ObjectEventArgs.cs" />
|
||||
<Compile Include="Controls\ChannelCard.xaml.cs">
|
||||
@@ -141,6 +142,9 @@
|
||||
<Compile Include="Pages\Home.xaml.cs">
|
||||
<DependentUpon>Home.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Inbox.xaml.cs">
|
||||
<DependentUpon>Inbox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\LoadingPage.xaml.cs">
|
||||
<DependentUpon>LoadingPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -194,6 +198,7 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\AnnouncementThumb.png" />
|
||||
<Content Include="Assets\ChannelCoverTemplate.png" />
|
||||
<Content Include="Assets\Data\Patchnotes.xml" />
|
||||
<Content Include="Assets\FoxGame.png" />
|
||||
<Content Include="Assets\Icons\Profile.png" />
|
||||
<Content Include="Assets\Icons\Send.png" />
|
||||
@@ -329,6 +334,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Inbox.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\LoadingPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<Page
|
||||
x:Class="FoxTube.Pages.Inbox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:FoxTube.Pages"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ScrollViewer>
|
||||
<StackPanel VerticalAlignment="Stretch" Background="#FFF2F2F2">
|
||||
<ComboBox Header="Filter" Margin="10" HorizontalAlignment="Stretch" SelectedIndex="0">
|
||||
<ComboBoxItem Content="All"/>
|
||||
<ComboBoxItem Content="Messages"/>
|
||||
<ComboBoxItem Content="Patch notes"/>
|
||||
</ComboBox>
|
||||
<ListBox>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ListBoxItem Padding="10" HorizontalContentAlignment="Stretch">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Margin="0,0,10,0">
|
||||
<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"/>
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock FontWeight="Bold" Text="{Binding Path=Title}"/>
|
||||
<TextBlock Foreground="Gray" Text="{Binding Path=Subtitle}"/>
|
||||
</StackPanel>
|
||||
<TextBlock Foreground="Gray" FontSize="13" Text="{Binding Path=Timestamp}" Grid.Column="2"/>
|
||||
</Grid>
|
||||
</ListBoxItem>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<ListBoxItem Padding="10" HorizontalContentAlignment="Stretch">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<PersonPicture Height="40" Initials="" FontFamily="Segoe MDL2 Assets" Background="Red" Margin="0,0,10,0"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock FontWeight="Bold" Text="What's new in v1.01"/>
|
||||
<TextBlock Foreground="Gray" Text="Patch note"/>
|
||||
</StackPanel>
|
||||
<TextBlock Foreground="Gray" FontSize="13" Text="11:00 PM" Grid.Column="2"/>
|
||||
</Grid>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Padding="10" HorizontalContentAlignment="Stretch">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<PersonPicture Height="40" Initials="" FontFamily="Segoe MDL2 Assets" Background="Red" Margin="0,0,10,0"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock FontWeight="Bold" Text="Hello, World! We went live!"/>
|
||||
<TextBlock Foreground="Gray" Text="Developer's message"/>
|
||||
</StackPanel>
|
||||
<TextBlock Foreground="Gray" FontSize="13" Text="11:00 PM" Grid.Column="2"/>
|
||||
</Grid>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Padding="10" HorizontalContentAlignment="Stretch">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Margin="0,0,10,0">
|
||||
<Ellipse Fill="Red" Height="40" Width="40"/>
|
||||
<TextBlock Foreground="White" FontFamily="Segoe MDL2 Assets" Text="" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Light" FontSize="17"/>
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock FontWeight="Bold" Text="Hello, World! We went live!"/>
|
||||
<TextBlock Foreground="Gray" Text="Developer's message"/>
|
||||
</StackPanel>
|
||||
<TextBlock Foreground="Gray" FontSize="13" Text="11:00 PM" Grid.Column="2"/>
|
||||
</Grid>
|
||||
</ListBoxItem>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<ScrollViewer Grid.Column="1">
|
||||
<StackPanel Margin="10">
|
||||
<TextBlock FontWeight="Bold" Text="Hello, World!" FontSize="26"/>
|
||||
<controls:MarkdownTextBlock IsTextSelectionEnabled="True" Text="Content"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class Inbox : Page
|
||||
{
|
||||
List<InboxItem> items = new List<InboxItem>();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user