Notification system development 1
This commit is contained in:
@@ -53,14 +53,14 @@
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ScrollViewer>
|
||||
<ScrollViewer Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}">
|
||||
<StackPanel VerticalAlignment="Stretch">
|
||||
<ComboBox Header="Filter" Margin="10" HorizontalAlignment="Stretch" SelectedIndex="0" Name="filter" SelectionChanged="filter_SelectionChanged">
|
||||
<ComboBoxItem Content="All"/>
|
||||
<ComboBoxItem Content="Messages"/>
|
||||
<ComboBoxItem Content="Patch notes"/>
|
||||
</ComboBox>
|
||||
<ListBox Name="list" SelectionChanged="list_SelectionChanged">
|
||||
<ListBox Name="list" SelectionChanged="list_SelectionChanged" Background="Transparent">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Padding" Value="10"/>
|
||||
@@ -72,18 +72,18 @@
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<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}"/>
|
||||
<TextBlock FontWeight="Bold" Text="{Binding Path=Title}" MaxLines="1" TextWrapping="Wrap"/>
|
||||
<TextBlock Opacity=".5" Text="{Binding Path=Subtitle}"/>
|
||||
</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>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
@@ -16,6 +16,7 @@ using FoxTube.Classes;
|
||||
using System.Xml;
|
||||
using Windows.Storage;
|
||||
using System.Diagnostics;
|
||||
using Windows.UI.Popups;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
@@ -26,7 +27,6 @@ namespace FoxTube.Pages.SettingsPages
|
||||
/// </summary>
|
||||
public sealed partial class Inbox : Page
|
||||
{
|
||||
public bool Loaded = false;
|
||||
List<InboxItem> backup = new List<InboxItem>();
|
||||
List<InboxItem> items = new List<InboxItem>();
|
||||
public Inbox()
|
||||
@@ -34,35 +34,36 @@ namespace FoxTube.Pages.SettingsPages
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
public async void LoadItems()
|
||||
public void LoadItems()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
try
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
string path = @"Assets\Data\Patchnotes.xml";
|
||||
StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
|
||||
StorageFile file = await InstallationFolder.GetFileAsync(path);
|
||||
Stream Countries = await file.OpenStreamForReadAsync();
|
||||
doc.Load("http://foxgame.hol.es/foxtube-changelog.xml");
|
||||
foreach (XmlElement e in doc["items"].ChildNodes)
|
||||
items.Add(new InboxItem(
|
||||
e.GetAttribute("version"),
|
||||
e["content"].InnerText,
|
||||
e.GetAttribute("time"),
|
||||
e.GetAttribute("id")
|
||||
));
|
||||
|
||||
doc.Load(Countries);
|
||||
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/foxtube-messages.xml");
|
||||
foreach (XmlElement e in doc["posts"].ChildNodes)
|
||||
items.Add(new InboxItem(
|
||||
e["header"].InnerText,
|
||||
e["content"].InnerText,
|
||||
DateTime.Parse(e.GetAttribute("time")),
|
||||
e.GetAttribute("id")
|
||||
));
|
||||
|
||||
doc.Load("http://foxgame.hol.es/ftp.xml");
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -138,5 +139,12 @@ namespace FoxTube.Pages.SettingsPages
|
||||
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