Archived
1
0

History (local)

This commit is contained in:
Michael Gordeev
2018-11-09 22:27:51 +03:00
parent 4d13ea1226
commit 1a6447a4aa
9 changed files with 100 additions and 56 deletions
+8 -8
View File
@@ -12,16 +12,16 @@
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Name="grid">
<ScrollViewer Margin="0,0,0,50">
<StackPanel Name="stack">
<local:VideoGrid/>
<controls:ShowMore Clicked="ShowMore_Clicked"/>
</StackPanel>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<ScrollViewer Name="scroll">
<local:VideoGrid/>
</ScrollViewer>
<CommandBar VerticalAlignment="Bottom">
<CommandBar Grid.Row="1">
<AppBarButton Label="Open in browser" Icon="Globe" Name="toBrowser" Click="toBrowser_Click"/>
<AppBarButton Label="Refresh" Icon="Refresh" Name="refresh" Click="refresh_Click"/>
</CommandBar>
<foxtube:LoadingPage Visibility="Collapsed"/>
<foxtube:LoadingPage Visibility="Collapsed" Grid.RowSpan="2"/>
</Grid>
</Page>
+14 -28
View File
@@ -1,17 +1,8 @@
using FoxTube.Controls;
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.System;
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 Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
@@ -24,15 +15,19 @@ namespace FoxTube.Pages
public sealed partial class History : Page
{
LoadingPage loading;
ShowMore more;
VideoGrid list;
public History()
{
this.InitializeComponent();
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
loading = grid.Children[2] as LoadingPage;
more = stack.Children[1] as ShowMore;
list = stack.Children[0] as VideoGrid;
list = scroll.Content as VideoGrid;
Initialize();
}
@@ -40,24 +35,15 @@ namespace FoxTube.Pages
{
loading.Refresh();
more.Complete(true);
list.Clear();
SecretsVault.UserHistory.ForEach(i => list.Add(new VideoCard(i)));
loading.Block();
loading.Close();
}
private void ShowMore_Clicked()
private async void toBrowser_Click(object sender, RoutedEventArgs e)
{
}
private void toBrowser_Click(object sender, RoutedEventArgs e)
{
}
private void refresh_Click(object sender, RoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new Uri("youtube.com/feed/history"));
}
}
}
+8 -6
View File
@@ -102,11 +102,13 @@ namespace FoxTube
public async void Initialize()
{
bool[] notificationsSettings = new bool[] { (bool)settings.Values["newVideoNotification"], (bool)settings.Values["devNews"] };
await FileIO.WriteTextAsync(
await ApplicationData.Current.RoamingFolder.CreateFileAsync("notifications.json", CreationCollisionOption.ReplaceExisting),
JsonConvert.SerializeObject(notificationsSettings));
Debug.WriteLine(ApplicationData.Current.RoamingFolder.Path);
if (await ApplicationData.Current.RoamingFolder.GetFileAsync("notifications.json") != null)
{
bool[] notificationsSettings = new bool[] { (bool)settings.Values["newVideoNotification"], (bool)settings.Values["devNews"] };
await FileIO.WriteTextAsync(
await ApplicationData.Current.RoamingFolder.CreateFileAsync("notifications.json", CreationCollisionOption.ReplaceExisting),
JsonConvert.SerializeObject(notificationsSettings));
}
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -128,7 +130,7 @@ namespace FoxTube
titleBar.ButtonBackgroundColor = Colors.Red;
titleBar.ButtonHoverBackgroundColor = Colors.IndianRed;
titleBar.ButtonPressedBackgroundColor = Colors.DarkRed;
titleBar.ButtonInactiveBackgroundColor = Colors.DeepPink;
titleBar.ButtonInactiveBackgroundColor = Colors.DarkRed;
titleBar.ForegroundColor = Colors.White;
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false;
+2 -2
View File
@@ -52,8 +52,8 @@ namespace FoxTube.Pages.SettingsPages
items.Add(new InboxItem(
e["header"].InnerText,
e["content"].InnerText,
DateTime.Parse(e.GetAttribute("time")),
e.GetAttribute("id")
DateTime.Parse(e["time"].InnerText),
e["id"].InnerText
));
items.OrderBy(item => item.TimeStamp);
+2
View File
@@ -208,6 +208,8 @@ namespace FoxTube.Pages
}
}
subscribe.Visibility = Visibility.Visible;
SecretsVault.HistoryAdd(videoId);
}
else
{