Archived
1
0

Temp dummy version

This commit is contained in:
Michael Gordeev
2020-07-06 18:34:34 +03:00
parent 787a6e9f48
commit 142cb1257e
69 changed files with 39 additions and 4204 deletions
-22
View File
@@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.28803.352
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FoxTube", "FoxTube\FoxTube.csproj", "{2597B816-7316-4D20-BA6C-D78001E89C1A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FoxTube", "FoxTube\FoxTube.csproj", "{2597B816-7316-4D20-BA6C-D78001E89C1A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FoxTube.Core", "FoxTube.Core\FoxTube.Core.csproj", "{29C01E10-76E7-4527-984F-B0EEF7E1AC64}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -43,26 +41,6 @@ Global
{2597B816-7316-4D20-BA6C-D78001E89C1A}.Release|x86.ActiveCfg = Release|x86 {2597B816-7316-4D20-BA6C-D78001E89C1A}.Release|x86.ActiveCfg = Release|x86
{2597B816-7316-4D20-BA6C-D78001E89C1A}.Release|x86.Build.0 = Release|x86 {2597B816-7316-4D20-BA6C-D78001E89C1A}.Release|x86.Build.0 = Release|x86
{2597B816-7316-4D20-BA6C-D78001E89C1A}.Release|x86.Deploy.0 = Release|x86 {2597B816-7316-4D20-BA6C-D78001E89C1A}.Release|x86.Deploy.0 = Release|x86
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|ARM.ActiveCfg = Debug|ARM
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|ARM.Build.0 = Debug|ARM
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|ARM64.ActiveCfg = Debug|ARM64
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|ARM64.Build.0 = Debug|ARM64
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|x64.ActiveCfg = Debug|x64
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|x64.Build.0 = Debug|x64
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|x86.ActiveCfg = Debug|x86
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Debug|x86.Build.0 = Debug|x86
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|Any CPU.Build.0 = Release|Any CPU
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|ARM.ActiveCfg = Release|ARM
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|ARM.Build.0 = Release|ARM
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|ARM64.ActiveCfg = Release|ARM64
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|ARM64.Build.0 = Release|ARM64
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|x64.ActiveCfg = Release|x64
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|x64.Build.0 = Release|x64
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|x86.ActiveCfg = Release|x86
{29C01E10-76E7-4527-984F-B0EEF7E1AC64}.Release|x86.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
-34
View File
@@ -7,7 +7,6 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/> <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
<ResourceDictionary Source="ResourceDictionaries/NavigationViewTemplate.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<ResourceDictionary.ThemeDictionaries> <ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark"> <ResourceDictionary x:Key="Dark">
@@ -20,23 +19,6 @@
<Color x:Key="SystemAccentColor">Red</Color> <Color x:Key="SystemAccentColor">Red</Color>
<Color x:Key="RadioButtonOuterEllipseCheckedStrokePointerOver">Gray</Color>
<Color x:Key="RadioButtonOuterEllipseCheckedFillPointerOver">Gray</Color>
<Color x:Key="RadioButtonOuterEllipseCheckedStrokePressed">DarkRed</Color>
<Color x:Key="RadioButtonOuterEllipseCheckedFillPressed">DarkRed</Color>
<Color x:Key="ComboBoxItemRevealBackgroundSelected">Red</Color>
<Color x:Key="ComboBoxItemRevealBackgroundSelectedPointerOver">Gray</Color>
<Color x:Key="ComboBoxItemRevealBackgroundSelectedPressed">DarkRed</Color>
<Color x:Key="ToggleSwitchFillOnPointerOver">Gray</Color>
<Style x:Key="HeaderButton" TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Width" Value="32"/>
</Style>
<Style TargetType="StackPanel"> <Style TargetType="StackPanel">
<Setter Property="ChildrenTransitions"> <Setter Property="ChildrenTransitions">
<Setter.Value> <Setter.Value>
@@ -49,22 +31,6 @@
<Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}"> <Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="Height" Value="32"/> <Setter Property="Height" Value="32"/>
</Style> </Style>
<Style TargetType="PivotItem">
<Setter Property="Margin" Value="0"/>
</Style>
<Style x:Key="HeaderActionButton" TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="0" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Height" Value="32" />
<Setter Property="Width" Value="40" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
<Setter Property="FontSize" Value="15" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style TargetType="TextBlock"> <Style TargetType="TextBlock">
<Setter Property="TextTrimming" Value="CharacterEllipsis"/> <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
+1 -57
View File
@@ -1,8 +1,4 @@
using System; using Windows.ApplicationModel.Activation;
using FoxTube.Utils;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Background;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
@@ -13,9 +9,6 @@ namespace FoxTube
public App() public App()
{ {
InitializeComponent(); InitializeComponent();
Suspending += OnSuspending;
UnhandledException += ErrorOccured;
} }
protected override void OnLaunched(LaunchActivatedEventArgs args) protected override void OnLaunched(LaunchActivatedEventArgs args)
@@ -24,16 +17,6 @@ namespace FoxTube
ActivateWindow(args); ActivateWindow(args);
} }
protected override async void OnBackgroundActivated(BackgroundActivatedEventArgs args)
{
base.OnBackgroundActivated(args);
BackgroundTaskDeferral defferal = args.TaskInstance.GetDeferral();
await BackgroundManager.PerformBackgroundTask(args);
defferal.Complete();
}
protected override void OnActivated(IActivatedEventArgs e) protected override void OnActivated(IActivatedEventArgs e)
{ {
base.OnActivated(e); base.OnActivated(e);
@@ -52,44 +35,5 @@ namespace FoxTube
Window.Current.Activate(); Window.Current.Activate();
} }
} }
private void OnSuspending(object sender, SuspendingEventArgs e)
{
Metrics.EndSession();
// TODO: Perform suspending tasks (complete downloads or cancel closing)
}
private async void ErrorOccured(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
{
Metrics.AddEvent("Application crashed",
("Exception", e.Exception.GetType().ToString()),
("Message", e.Message),
("StackTrace", e.Exception.StackTrace));
e.Handled = true;
ContentDialogResult result = await new ContentDialog
{
Title = "Something went wrong...",
Content = "It may be a bug or temporary server issues. Please, try again later\n\nIf this happens again try to reset your app settings or report the problem",
PrimaryButtonText = "Report the problem",
SecondaryButtonText = "Reset application",
CloseButtonText = "Restart the app",
DefaultButton = ContentDialogButton.Primary
}.ShowAsync();
switch (result)
{
case ContentDialogResult.Primary:
FeedbackInterop.OpenFeedbackHub();
break;
case ContentDialogResult.Secondary:
Utils.Utils.InitializeFailsafeProtocol();
break;
default:
Utils.Utils.RestartApp();
break;
}
}
} }
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

@@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 394 294"><title>CardTemplate</title><rect x="0.5" y="0.5" width="393" height="293" rx="4.5" style="fill:#1f1f1f"/><path d="M392,4a4,4,0,0,1,4,4V292a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4H392m0-1H8A5,5,0,0,0,3,8V292a5,5,0,0,0,5,5H392a5,5,0,0,0,5-5V8a5,5,0,0,0-5-5Z" transform="translate(-3 -3)"/><path d="M395,224H5V10a5,5,0,0,1,5-5H390a5,5,0,0,1,5,5Z" transform="translate(-3 -3)" style="fill:#2b2b2b"/><circle cx="35" cy="221" r="23.5" style="fill:#2b2b2b"/><path d="M38,202a22,22,0,1,1-22,22,22,22,0,0,1,22-22m0-3a25,25,0,1,0,25,25,25,25,0,0,0-25-25Z" transform="translate(-3 -3)" style="fill:#1f1f1f"/><rect x="10" y="252" width="337" height="13" style="fill:#2b2b2b"/><rect x="70" y="229" width="146" height="13" style="fill:#2b2b2b"/><rect x="265" y="229" width="119" height="13" style="fill:#2b2b2b"/><rect x="10" y="272" width="269" height="13" style="fill:#2b2b2b"/><rect x="245" y="194" width="144" height="17" rx="5" style="fill:#1f1f1f"/></svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

-86
View File
@@ -1,86 +0,0 @@
using System.Collections.Generic;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media.Imaging;
using FoxTube.Models;
using FoxTube.Views.HomeSections;
using FoxTube.Views;
using FoxTube.Services;
namespace FoxTube.Utils
{
public static class MenuItemsList
{
public static List<Microsoft.UI.Xaml.Controls.NavigationViewItemBase> GetMenuItems(bool authorized)
{
List<Microsoft.UI.Xaml.Controls.NavigationViewItemBase> list = new List<Microsoft.UI.Xaml.Controls.NavigationViewItemBase>();
if (authorized)
list.AddRange(new Microsoft.UI.Xaml.Controls.NavigationViewItemBase[]
{
GetItem("Home", new SymbolIcon(Symbol.Home), typeof(HomeView)),
new Microsoft.UI.Xaml.Controls.NavigationViewItemHeader { Content = "Library" },
GetItem("History", new FontIcon { Glyph = "\xE81C" }, typeof(HistoryView)),
GetItem("Liked videos", new SymbolIcon(Symbol.Like), (typeof(PlaylistView), UserService.CurrentUser.Channel.ContentDetails.RelatedPlaylists.Likes)),
GetItem("Watch later", new SymbolIcon(Symbol.Clock), (typeof(PlaylistView), "WL")),
GetItem("Downloads", new SymbolIcon(Symbol.Download), typeof(DownloadsView)),
GetItem("Subscriptions", new SymbolIcon(Symbol.People), typeof(SubscriptionsView))
});
else
list.AddRange(new Microsoft.UI.Xaml.Controls.NavigationViewItemBase[]
{
GetItem("Home", new SymbolIcon(Symbol.Home), typeof(TrendingView)),
GetItem("Downloads", new SymbolIcon(Symbol.Download), typeof(DownloadsView)),
new Microsoft.UI.Xaml.Controls.NavigationViewItemHeader { Content = "Best of YouTube" },
GetItem("Music", new FontIcon { Glyph = "\xE189" }, "UC-9-kyTW8ZkZNDHQJ6FgpwQ"),
GetItem("Sports", new FontIcon { Glyph = "\xE95E" }, "UCEgdi0XIXXZ-qJOFPf4JSKw"),
GetItem("Movies", new FontIcon { Glyph = "\xE8B2" }, "UClgRkhTL3_hImCAmdLfDE4g"),
GetItem("News", new FontIcon { Glyph = "\xE12A" }, "UCYfdidRxbB8Qhf0Nx7ioOYw"),
GetItem("Live", new FontIcon { Glyph = "\xE93E" }, "UC4R8DWoMoI7CAwX8_LjQHig"),
GetItem("Spotlight", new FontIcon { Glyph = "\xECAD" }, "UC8iNz9uwDGfomRnnKKbOhOQ"),
GetItem("360° videos", new FontIcon { Glyph = "\xF131" }, "UCzuqhhs6NWbgTzMuM09WKDQ"),
});
return list;
}
private static Microsoft.UI.Xaml.Controls.NavigationViewItem GetItem(string content, IconElement icon, object tag) =>
new Microsoft.UI.Xaml.Controls.NavigationViewItem
{
Content = content,
Icon = icon,
Tag = tag
};
public static Microsoft.UI.Xaml.Controls.NavigationViewItem GenerateItemFromSubscription(Subscription subscription)
{
Grid grid = new Grid
{
ColumnSpacing = 12
};
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(20) });
grid.ColumnDefinitions.Add(new ColumnDefinition());
grid.Children.Add(new Microsoft.UI.Xaml.Controls.PersonPicture
{
Width = 20,
ProfilePicture = new BitmapImage().LoadImage(subscription.Avatar.Default__.Url, 20, 20)
});
grid.Children.Add(new TextBlock
{
Text = subscription.Title
});
Grid.SetColumn(grid.Children[1] as TextBlock, 1);
return new Microsoft.UI.Xaml.Controls.NavigationViewItem
{
Content = grid,
Tag = subscription.ChannelId
};
}
}
}
-16
View File
@@ -1,16 +0,0 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Pages
{
public class ScrollPage : Page
{
public ScrollViewer ScrollViewer => base.Content as ScrollViewer;
public new UIElement Content => ScrollViewer.Content as UIElement;
public ScrollPage()
{
base.Content = new ScrollViewer();
}
}
}
-27
View File
@@ -1,27 +0,0 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Classes
{
public class TemplatedPage : Page
{
public UIElement PageDummy
{
get => ((base.Content as Grid).Children[0] as ContentPresenter).Content as UIElement;
set => ((base.Content as Grid).Children[0] as ContentPresenter).Content = value;
}
public new UIElement Content
{
get => ((base.Content as Grid).Children[1] as ContentPresenter).Content as UIElement;
set => ((base.Content as Grid).Children[1] as ContentPresenter).Content = value;
}
public TemplatedPage()
{
Grid grid = new Grid();
grid.Children.Add(new ContentPresenter());
grid.Children.Add(new ContentPresenter());
base.Content = grid;
}
}
}
-55
View File
@@ -1,55 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.UI.Core;
using Windows.UI.Xaml.Data;
namespace FoxTube.Models
{
public class ViewItemsCollection : ObservableCollection<object>, ISupportIncrementalLoading
{
public event EventHandler ItemsUpdated;
public bool HasMoreItems
{
get => _hasMoreItems;
private set
{
_hasMoreItems = value;
ItemsUpdated?.Invoke(this, null);
}
}
private bool _hasMoreItems = true;
private IIncrementalLoadingHost Host { get; set; }
public ViewItemsCollection(IIncrementalLoadingHost host) =>
Host = host;
public IAsyncOperation<LoadMoreItemsResult> LoadMoreItemsAsync(uint count) =>
AsyncInfo.Run((c) => LoadItems());
private async Task<LoadMoreItemsResult> LoadItems()
{
(List<object> items, bool hasMore) = await Host.LoadMoreItems();
HasMoreItems = hasMore;
await Host.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
items.ForEach(i =>
Add(i));
});
return new LoadMoreItemsResult { Count = (uint)items.Count };
}
}
public interface IIncrementalLoadingHost
{
Task<(List<object>, bool)> LoadMoreItems();
CoreDispatcher Dispatcher { get; }
}
}
-165
View File
@@ -1,165 +0,0 @@
<Button
x:Class="FoxTube.Controls.AccountManager"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:data="using:Google.Apis.Oauth2.v2.Data"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:Microsoft.UI.Xaml.Controls"
Height="32"
Padding="10,0"
Background="Transparent"
CornerRadius="0"
Loaded="AppBarButton_Loaded"
Style="{StaticResource ButtonRevealStyle}"
mc:Ignorable="d">
<StackPanel Orientation="Horizontal">
<FontIcon
x:Name="icon"
FontSize="15"
Glyph="&#xE1E2;"
Visibility="Visible" />
<PersonPicture
x:Name="profileIcon"
Width="20"
Visibility="Collapsed" />
<TextBlock
x:Name="buttonLabel"
Margin="10,0,0,0"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="Sign in" />
</StackPanel>
<Button.Flyout>
<Flyout Opening="Flyout_Opening">
<StackPanel Width="300" Margin="-12">
<Grid Height="60">
<controls:ImageEx
x:Name="bannerImage"
PlaceholderSource="/Assets/DefaultChannelBanner.png"
PlaceholderStretch="UniformToFill"
Stretch="UniformToFill" />
<Grid
Padding="10"
ColumnSpacing="20"
RequestedTheme="Dark">
<Grid.Background>
<AcrylicBrush
FallbackColor="Transparent"
Opacity=".9"
TintColor="Black"
TintLuminosityOpacity=".5"
TintOpacity="0" />
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<PersonPicture x:Name="avatar" Height="40" />
<StackPanel Grid.Column="1">
<TextBlock x:Name="name" Text="[Name]" />
<TextBlock
x:Name="email"
FontStyle="Italic"
Text="[email]" />
</StackPanel>
<Button
Grid.Column="2"
Background="Transparent"
Content="&#xE115;"
FontFamily="Segoe MDL2 Assets"
ToolTipService.ToolTip="Account settings" />
</Grid>
</Grid>
<NavigationViewList>
<NavigationViewItem
Content="My channel"
Icon="Contact"
Tag="channel"
Tapped="NavigationViewItem_Tapped" />
<NavigationViewItem
Content="Upload a video"
Icon="Upload"
Tag="upload"
Tapped="NavigationViewItem_Tapped" />
<NavigationViewItem
Content="Start a broadcast"
Tag="broadcast"
Tapped="NavigationViewItem_Tapped">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE93E;" />
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem
Content="Creator Stuido"
Tag="creatorStudio"
Tapped="NavigationViewItem_Tapped">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE2B1;" />
</NavigationViewItem.Icon>
</NavigationViewItem>
</NavigationViewList>
<NavigationViewList
x:Name="usersList"
IsItemClickEnabled="True"
ItemClick="SwitchUser">
<NavigationViewList.ItemTemplate>
<DataTemplate x:DataType="data:Userinfoplus">
<StackPanel
Margin="-5,0,0,0"
Padding="5"
Orientation="Horizontal">
<ui:PersonPicture Height="20" Margin="-5,0,15,0">
<ui:PersonPicture.ProfilePicture>
<BitmapImage
DecodePixelHeight="20"
DecodePixelWidth="20"
UriSource="{Binding Picture}" />
</ui:PersonPicture.ProfilePicture>
</ui:PersonPicture>
<StackPanel>
<TextBlock FontSize="14" Text="{Binding Name, TargetNullValue='[name]'}" />
<TextBlock
Margin="0,-6,0,0"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding Email}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</NavigationViewList.ItemTemplate>
<NavigationViewItemHeader Content="Switch account" />
</NavigationViewList>
<NavigationViewList>
<NavigationViewItemSeparator />
<NavigationViewItem
x:Name="addAccountButton"
Content="Add account"
Icon="Add"
Tag="addUser"
Tapped="NavigationViewItem_Tapped" />
<NavigationViewItem Tapped="Incognito_Tapped">
<ToggleSwitch
x:Name="incognito"
OffContent="Incognito mode"
OnContent="Incognito mode"
Toggled="Icognito_Toggled" />
</NavigationViewItem>
<NavigationViewItem
Content="Sign out"
Foreground="Red"
Tag="logout"
Tapped="NavigationViewItem_Tapped">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE1E0;" />
</NavigationViewItem.Icon>
</NavigationViewItem>
</NavigationViewList>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
-130
View File
@@ -1,130 +0,0 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using FoxTube.Models;
using System.Linq;
using Google.Apis.Oauth2.v2.Data;
using Windows.UI.Xaml.Media.Imaging;
using FoxTube.Services;
using System;
using FoxTube.Utils;
namespace FoxTube.Controls
{
public sealed partial class AccountManager : Button
{
private User CurrentUser { get; set; }
public AccountManager() =>
InitializeComponent();
private async void Flyout_Opening(object sender, object args)
{
if (UserService.Authorized)
return;
(sender as Flyout).Hide();
try
{
await UserService.AddUser();
}
catch (Exception e)
{
await new ContentDialog
{
Title = "Failed to add account",
Content = "Something went wrong. Please, try again later"
}.ShowAsync();
Metrics.SendReport(new Exception("Failed to login", e));
}
}
private void AppBarButton_Loaded(object sender, RoutedEventArgs e)
{
if (UserService.Authorized)
UpdateData(true);
UserService.UserStateUpdated += (s, e) => UpdateData(e);
}
private void UpdateData(bool authorized)
{
CurrentUser = UserService.CurrentUser;
if (authorized)
{
buttonLabel.Text = name.Text = CurrentUser.Channel.Snippet.Title;
email.Text = CurrentUser.UserInfo.Email;
profileIcon.ProfilePicture = new BitmapImage().LoadImage(CurrentUser.Channel.Snippet.Thumbnails.Default__.Url, 20, 20);
avatar.ProfilePicture = new BitmapImage().LoadImage(CurrentUser.Channel.Snippet.Thumbnails.Default__.Url, 40, 40);
bannerImage.Source = new BitmapImage().LoadImage(CurrentUser.Channel.BrandingSettings.Image.BannerMobileLowImageUrl, 60);
ToolTipService.SetToolTip(this, $"{CurrentUser.UserInfo.Name} ({CurrentUser.UserInfo.Email})");
icon.Visibility = Visibility.Collapsed;
profileIcon.Visibility = Visibility.Visible;
var users = UserService.Users.Where(i => i.Id != CurrentUser.UserInfo.Id).ToList();
usersList.ItemsSource = users;
usersList.Visibility = users.Count > 0 ? Visibility.Visible : Visibility.Visible;
addAccountButton.Visibility = UserService.CanAddAccounts ? Visibility.Visible : Visibility.Collapsed;
}
else
{
buttonLabel.Text = name.Text = "Sign in";
ToolTipService.SetToolTip(this, null);
icon.Visibility = Visibility.Visible;
profileIcon.Visibility = Visibility.Collapsed;
}
}
private async void SwitchUser(object sender, ItemClickEventArgs e)
{
Userinfoplus user = (Userinfoplus)e.ClickedItem;
await UserService.SwitchUser(UserService.Users.ToList().IndexOf(user));
}
private async void NavigationViewItem_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
{
switch ((sender as NavigationViewItem).Tag as string)
{
case "channel":
case "upload":
case "broadcast":
case "creatorStudio":
break;
case "addUser":
await UserService.AddUser();
break;
case "logout":
await UserService.Logout();
break;
}
}
private void Incognito_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) =>
incognito.IsOn = !incognito.IsOn;
private void Icognito_Toggled(object sender, RoutedEventArgs e)
{
if (incognito.IsOn)
MainPage.Current.RequestedTheme = ElementTheme.Dark;
else
{
MainPage.Current.RequestedTheme = ElementTheme.Default;
if ((Window.Current.Content as Frame).RequestedTheme == ElementTheme.Default)
Utils.Utils.UpdateTitleBarTheme(Application.Current.RequestedTheme == ApplicationTheme.Dark);
else
Utils.Utils.UpdateTitleBarTheme(MainPage.Current.RequestedTheme == ElementTheme.Dark);
}
MainPage.Current.UpdateLayout();
UserService.IncognitoMode = incognito.IsOn;
}
}
}
-52
View File
@@ -1,52 +0,0 @@
<UserControl
x:Class="FoxTube.Controls.Cards.AdvertCard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
d:DesignHeight="300"
d:DesignWidth="400"
HorizontalAlignment="Stretch"
Margin="3"
SizeChanged="UserControl_SizeChanged"
Opacity="0">
<UserControl.OpacityTransition>
<ScalarTransition/>
</UserControl.OpacityTransition>
<Button Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Style="{StaticResource ButtonRevealStyle}" CornerRadius="5" Padding="0" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch">
<Grid RowSpacing="5" x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="20"/>
<RowDefinition/>
</Grid.RowDefinitions>
<controls:ImageEx PlaceholderStretch="UniformToFill" CornerRadius="5,5,0,0" PlaceholderSource="/Assets/DefaultVideoThumbnail.png" Source="{Binding advert.MainImages[0].Url}"/>
<StackPanel Padding="5,2,5,3" Background="Orange" CornerRadius="5" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5">
<TextBlock Text="Sponsored content" Foreground="Black" Style="{StaticResource CaptionTextBlockStyle}"/>
</StackPanel>
<StackPanel Padding="5,2,5,3" Background="Yellow" CornerRadius="5" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="5" x:Name="cta">
<TextBlock Text="{x:Bind advert.CallToActionText}" MaxLines="1" Foreground="Black" Style="{StaticResource CaptionTextBlockStyle}"/>
</StackPanel>
<Grid Grid.Row="1" ColumnSpacing="10" Margin="10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ImageEx CornerRadius="999" BorderThickness="3" BorderBrush="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Background="Red"
Width="50" Height="50" VerticalAlignment="Bottom" Margin="0,-30,0,0" PlaceholderSource="/Assets/Icons/Contact.png" PlaceholderStretch="UniformToFill" Source="{x:Bind advert.AdIcon}"/>
<TextBlock Text="{x:Bind advert.SponsoredBy}" Grid.Column="1" MaxLines="1"/>
<TextBlock x:Name="description" Grid.Column="2" MaxLines="1" Foreground="Gray"/>
</Grid>
<TextBlock Margin="10,0" Grid.Row="2" MaxLines="2" Text="{x:Bind advert.Title}"/>
</Grid>
</Button>
</UserControl>
-63
View File
@@ -1,63 +0,0 @@
using FoxTube.Services;
using FoxTube.Utils;
using Microsoft.Advertising.WinRT.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Controls.Cards
{
/// <summary>
/// Advert which is looks similar to video cards
/// </summary>
public sealed partial class AdvertCard : UserControl
{
readonly NativeAdsManagerV2 manager = AddonsInterop.AdsManager;
NativeAdV2 advert;
public AdvertCard()
{
InitializeComponent();
manager.AdReady += AdReady;
manager.ErrorOccurred += ErrorOccurred;
manager.RequestAd();
}
void ErrorOccurred(object sender, NativeAdErrorEventArgs e)
{
UnsubscribeEvents();
(Parent as Panel)?.Children.Remove(this);
Metrics.AddEvent("Error has occured while loading ad",
("Code", e.ErrorCode.ToString()),
("Message", e.ErrorMessage),
("Request ID", e.RequestId));
}
void AdReady(object sender, NativeAdReadyEventArgs e)
{
UnsubscribeEvents();
advert = e.NativeAd;
if (string.IsNullOrWhiteSpace(advert.CallToActionText))
cta.Visibility = Visibility.Collapsed;
description.Text = $"{advert.Price} {advert.Rating}";
e.NativeAd.RegisterAdContainer(grid);
Opacity = 1;
/*Metrics.AddEvent("Advert loaded",
("Region", Storage.GetValue<string>(Storage.Settings.Region)),
("Version", Metrics.CurrentVersion));*/
}
private void UnsubscribeEvents()
{
manager.AdReady -= AdReady;
manager.ErrorOccurred -= ErrorOccurred;
}
void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) =>
Height = .75 * ActualWidth;
}
}
-92
View File
@@ -1,92 +0,0 @@
<UserControl
x:Class="FoxTube.Controls.Cards.ChannelCard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400"
HorizontalAlignment="Stretch"
Margin="3"
SizeChanged="UserControl_SizeChanged">
<controls:DropShadowPanel BlurRadius="10" ShadowOpacity=".5"
OffsetX="2" OffsetY="2"
Color="Black"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Button Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Style="{StaticResource ButtonRevealStyle}" Windows10version1809:CornerRadius="5" Padding="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RowSpacing="5">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<controls:ImageEx Stretch="UniformToFill" PlaceholderStretch="UniformToFill" CornerRadius="5,5,0,0" PlaceholderSource="/Assets/DefaultChannelBanner.png"/>
<controls:DropShadowPanel VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="5,10" OffsetX="2" OffsetY="2">
<StackPanel Padding="5,2,5,3" Background="Red" BorderThickness="1" BorderBrush="White" CornerRadius="5" Orientation="Horizontal">
<FontIcon Glyph="&#xEC44;" VerticalAlignment="Center" Foreground="White" FontSize="12" Margin="0,0,5,0"/>
<TextBlock Name="liveContent" Text="LIVE" VerticalAlignment="Center" Foreground="White" FontSize="12" FontWeight="Bold"/>
</StackPanel>
</controls:DropShadowPanel>
<Grid Grid.Row="1" ColumnSpacing="20" VerticalAlignment="Center" Margin="10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<controls:ImageEx CornerRadius="999" Background="Red"
Width="75" Height="75" PlaceholderSource="/Assets/Icons/Contact.png" PlaceholderStretch="UniformToFill"/>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<TextBlock Text="██████████" Style="{StaticResource SubtitleTextBlockStyle}"/>
<FontIcon Glyph="&#xEC61;" VerticalAlignment="Bottom" Margin="10,0,10,5" FontSize="12" ToolTipService.ToolTip="Verified"/>
</StackPanel>
<TextBlock Text="██████ • ██████"/>
<Grid ColumnSpacing="2" Margin="0,5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<Button Style="{StaticResource ButtonRevealStyle}" Height="35" Background="Red" Foreground="White" HorizontalAlignment="Stretch" Content="Subscribe"/>
<Button Style="{StaticResource ButtonRevealStyle}" Height="35" Background="Red" Foreground="White" HorizontalAlignment="Stretch" Grid.Column="1">
<FontIcon Glyph="&#xEA8F;"/>
</Button>
</Grid>
</StackPanel>
</Grid>
<TextBlock Margin="10" Grid.Row="2" MaxLines="4" TextTrimming="CharacterEllipsis" TextWrapping="WrapWholeWords" Text="██████████"/>
</Grid>
<Button.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Icon="Play" Text="Play" Name="play"/>
<MenuFlyoutItem Text="Play incognito" Name="incognito">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE727;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Icon="Contact" Text="View channel" Name="viewChannel" />
<MenuFlyoutSeparator/>
<MenuFlyoutItem Icon="Link" Text="Copy link" Name="getLink"/>
<MenuFlyoutItem Icon="Globe" Text="Open in browser" Name="inBrowser"/>
<MenuFlyoutItem Icon="Share" Text="Share" Name="share"/>
<MenuFlyoutSeparator/>
<MenuFlyoutSubItem Icon="Download" Text="Download" Name="download"/>
<MenuFlyoutSubItem Icon="Add" Text="Add to" Name="addTo">
<MenuFlyoutItem Text="New playlist" Name="newPlaylist" Icon="Add"/>
<ToggleMenuFlyoutItem Text="Watch later" Name="wl" Icon="Clock"/>
<MenuFlyoutSeparator/>
</MenuFlyoutSubItem>
<MenuFlyoutItem Text="Remove from playlist" Icon="Delete" Visibility="Visible" Foreground="Red" Name="delete"/>
</MenuFlyout>
</Button.ContextFlyout>
</Button>
</controls:DropShadowPanel>
</UserControl>
@@ -1,14 +0,0 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Controls.Cards
{
public sealed partial class ChannelCard : UserControl
{
public ChannelCard() =>
InitializeComponent();
void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) =>
Height = .75 * ActualWidth;
}
}
-69
View File
@@ -1,69 +0,0 @@
<UserControl
x:Class="FoxTube.Controls.Cards.PlaylistCard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400"
HorizontalAlignment="Stretch"
Margin="3"
SizeChanged="UserControl_SizeChanged">
<controls:DropShadowPanel BlurRadius="10" ShadowOpacity=".5"
OffsetX="2" OffsetY="2"
Color="Black"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Button Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Style="{StaticResource ButtonRevealStyle}" Windows10version1809:CornerRadius="5" Padding="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RowSpacing="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="20"/>
<RowDefinition/>
</Grid.RowDefinitions>
<controls:ImageEx PlaceholderStretch="UniformToFill" CornerRadius="5,5,0,0" PlaceholderSource="/Assets/DefaultVideoThumbnail.png"/>
<Grid HorizontalAlignment="Right" Width="100">
<Grid.Background>
<AcrylicBrush TintColor="Black" TintOpacity=".5"/>
</Grid.Background>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<FontIcon HorizontalAlignment="Center" Foreground="White" Glyph="&#xE90B;" FontSize="30"/>
<TextBlock Foreground="White" Text="██" HorizontalAlignment="Center" FontSize="20"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1" ColumnSpacing="10" Margin="10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ImageEx CornerRadius="999" BorderThickness="3" BorderBrush="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Background="Red"
Width="50" Height="50" VerticalAlignment="Bottom" Margin="0,-30,0,0" PlaceholderSource="/Assets/Icons/Contact.png" PlaceholderStretch="UniformToFill"/>
<TextBlock TextTrimming="CharacterEllipsis" Grid.Column="1" Text="██████████"/>
<TextBlock Grid.Column="2" Text="██████████" Foreground="Gray"/>
</Grid>
<TextBlock Margin="10,0" Grid.Row="2" MaxLines="2" TextTrimming="CharacterEllipsis" TextWrapping="WrapWholeWords" Text="██████████"/>
</Grid>
<Button.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Icon="List" Text="View playlist"/>
<MenuFlyoutItem Icon="Contact" Text="View channel"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem Icon="Link" Text="Copy link"/>
<MenuFlyoutItem Icon="Globe" Text="Open in browser"/>
<MenuFlyoutItem Icon="Share" Text="Share"/>
</MenuFlyout>
</Button.ContextFlyout>
</Button>
</controls:DropShadowPanel>
</UserControl>
@@ -1,14 +0,0 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Controls.Cards
{
public sealed partial class PlaylistCard : UserControl
{
public PlaylistCard() =>
InitializeComponent();
void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) =>
Height = .75 * ActualWidth;
}
}
-92
View File
@@ -1,92 +0,0 @@
<UserControl
x:Class="FoxTube.Controls.Cards.VideoCard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
d:DesignHeight="300"
d:DesignWidth="400"
HorizontalAlignment="Stretch"
Margin="3"
Opacity="0">
<UserControl.OpacityTransition>
<ScalarTransition/>
</UserControl.OpacityTransition>
<Button Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Style="{StaticResource ButtonRevealStyle}" CornerRadius="5" Padding="0" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch">
<Grid RowSpacing="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="20"/>
<RowDefinition/>
</Grid.RowDefinitions>
<controls:ImageEx PlaceholderStretch="UniformToFill" CornerRadius="5,5,0,0" PlaceholderSource="/Assets/DefaultVideoThumbnail.png" Source="{x:Bind VideoData.Snippet.Thumbnails.Maxres.Url}"/>
<Grid x:Name="watched" Visibility="Collapsed">
<Grid.Background>
<SolidColorBrush Color="Black" Opacity=".5"/>
</Grid.Background>
<StackPanel Padding="5,2,5,3" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" CornerRadius="5" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5">
<TextBlock Text="Watched" Foreground="Gray" Style="{StaticResource CaptionTextBlockStyle}"/>
</StackPanel>
<ProgressBar VerticalAlignment="Bottom" Margin="59,0,0,0" Value="50"/>
</Grid>
<StackPanel Padding="5,2,5,3" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" CornerRadius="5" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="5,10">
<TextBlock Text="[Duration] • [Timestamp]" Foreground="Gray" Style="{StaticResource CaptionTextBlockStyle}"/>
</StackPanel>
<StackPanel Padding="5,2,5,3" Background="Red" BorderThickness="1" BorderBrush="White" CornerRadius="5" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="5,35" Visibility="Collapsed">
<FontIcon Glyph="&#xEC44;" VerticalAlignment="Center" Foreground="White" FontSize="12" Margin="0,0,5,0"/>
<TextBlock Text="LIVE" VerticalAlignment="Center" Foreground="White" Style="{StaticResource CaptionTextBlockStyle}" FontWeight="Bold"/>
</StackPanel>
<Grid Grid.Row="1" ColumnSpacing="10" Margin="10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ImageEx CornerRadius="999" BorderThickness="3" BorderBrush="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Background="Red"
Width="50" Height="50" VerticalAlignment="Bottom" Margin="0,-30,0,0" PlaceholderSource="/Assets/Icons/Contact.png" PlaceholderStretch="UniformToFill"/>
<TextBlock Text="{x:Bind VideoData.Snippet.ChannelTitle}" Grid.Column="1" MaxLines="1"/>
<TextBlock Text="[Views]" Grid.Column="2" MaxLines="1" Foreground="Gray"/>
</Grid>
<TextBlock Margin="10,0" Grid.Row="2" MaxLines="2" Text="{x:Bind VideoData.Snippet.Title}"/>
</Grid>
<Button.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Icon="Play" Text="Play"/>
<MenuFlyoutItem Text="Play incognito">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE727;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Text="Open in picture-in-picture mode">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE2B3;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Icon="Contact" Text="View channel"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem Icon="Link" Text="Copy link"/>
<MenuFlyoutItem Icon="Globe" Text="Open in browser"/>
<MenuFlyoutItem Icon="Share" Text="Share"/>
<MenuFlyoutSeparator/>
<MenuFlyoutSubItem Icon="Download" Text="Download"/>
<MenuFlyoutSubItem Icon="Add" Text="Add to">
<MenuFlyoutItem Text="New playlist" Icon="Add"/>
<ToggleMenuFlyoutItem Text="Watch later" Icon="Clock"/>
<MenuFlyoutSeparator/>
</MenuFlyoutSubItem>
<MenuFlyoutItem Text="Remove from playlist" Icon="Delete" Visibility="Visible" Foreground="Red"/>
</MenuFlyout>
</Button.ContextFlyout>
</Button>
</UserControl>
-27
View File
@@ -1,27 +0,0 @@
using Google.Apis.YouTube.v3.Data;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Controls.Cards
{
public sealed partial class VideoCard : UserControl
{
Video VideoData { get; set; }
public VideoCard(Video meta)
{
InitializeComponent();
VideoData = meta;
Opacity = 1;
}
public VideoCard(Video meta, Playlist playlist, IEnumerable<PlaylistItem> playlistItems) =>
InitializeComponent();
//void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) =>
// Height = .75 * ActualWidth;
}
}
@@ -1,40 +0,0 @@
<ContentDialog
x:Class="FoxTube.Controls.Dialogs.DownloadVideoDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
Title="Download video"
Loading="ContentDialog_Loading"
IsPrimaryButtonEnabled="False"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
PrimaryButtonText="Download"
CloseButtonText="Cancel"
DefaultButton="Primary">
<StackPanel>
<Grid Height="60" ColumnSpacing="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<controls:ImageEx PlaceholderSource="/Assets/DefaultVideoThumbnail.png" Stretch="UniformToFill" Source="{x:Bind Meta.Thumbnails.LowResUrl}" PlaceholderStretch="UniformToFill"/>
<StackPanel Grid.Column="1">
<TextBlock Text="{x:Bind Meta.Title}"/>
<TextBlock Text="{x:Bind Meta.Author}" Style="{StaticResource CaptionTextBlockStyle}" FontStyle="Italic"/>
<TextBlock Text="{x:Bind Meta.Duration}" Style="{StaticResource CaptionTextBlockStyle}" Foreground="Gray"/>
</StackPanel>
</Grid>
<ComboBox Header="Select download quality" HorizontalAlignment="Stretch" PlaceholderText="No qualities available to download" SelectedIndex="0" Margin="0,5" x:Name="qualitiesList" SelectionChanged="SelectionChanged"/>
<TextBox IsReadOnly="True" Header="Location" PlaceholderText="Folder/FileName" x:Name="location"/>
<Button Content="Change" HorizontalAlignment="Right" Margin="0,5" Click="SelectSaveLocation"/>
</StackPanel>
</ContentDialog>
@@ -1,73 +0,0 @@
using FoxTube.Services;
using System;
using System.Linq;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using YoutubeExplode.Videos;
using YoutubeExplode.Videos.Streams;
namespace FoxTube.Controls.Dialogs
{
public sealed partial class DownloadVideoDialog : ContentDialog
{
public Video Meta { get; set; }
public StreamManifest Manifest { get; set; }
public StorageFile File { get; set; }
public DownloadVideoDialog(Video meta, StreamManifest manifest)
{
InitializeComponent();
Meta = meta;
Manifest = manifest;
foreach (MuxedStreamInfo i in manifest.GetMuxed())
qualitiesList.Items.Add(new ComboBoxItem
{
Content = i.VideoQualityLabel,
Tag = i
});
AudioOnlyStreamInfo audioStream = manifest.GetAudioOnly().FirstOrDefault();
if (audioStream != null)
qualitiesList.Items.Add(new ComboBoxItem
{
Content = "Audio track only",
Tag = audioStream
});
}
private async void ContentDialog_Loading(FrameworkElement sender, object args)
{
StorageFolder defaultFolder = await DownloadsService.GetDefaultDownloadsFolder();
location.Text = $"{defaultFolder.Name}\\{Meta.Title.ReplaceInvalidChars('_')}.mp4";
}
private async void SelectSaveLocation(object sender, RoutedEventArgs e)
{
FileSavePicker picker = new FileSavePicker
{
SuggestedFileName = Meta.Title.ReplaceInvalidChars('_'),
DefaultFileExtension = ".mp4",
SuggestedStartLocation = PickerLocationId.VideosLibrary
};
picker.FileTypeChoices.Add("Video file", new[] { ".mp4" });
File = await picker.PickSaveFileAsync();
location.Text = $"{(await File.GetParentAsync()).Name}\\{File.Name}";
}
private void SelectionChanged(object sender, SelectionChangedEventArgs e) =>
IsPrimaryButtonEnabled = true;
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
}
}
}
@@ -1,67 +0,0 @@
<ContentDialog
x:Class="FoxTube.Controls.Dialogs.ProOfferDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
PrimaryButtonText="Purchase"
CloseButtonText="Maybe later"
DefaultButton="Primary"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick">
<StackPanel>
<StackPanel Orientation="Horizontal">
<Image Source="/Assets/Logo.png" Stretch="UniformToFill" Width="100"/>
<StackPanel VerticalAlignment="Center" Margin="20,0">
<TextBlock Text="FoxTube Pro" FontSize="26" FontWeight="SemiBold"/>
<TextBlock Text="One-time payment"/>
</StackPanel>
<Button x:Name="getButton" Click="GetButton_Click" Content="Get for $5!" Background="{StaticResource SystemAccentColor}" Foreground="White"/>
</StackPanel>
<TextBlock Text="What you will get with FoxTube Pro:" FontSize="20"/>
<Grid ColumnSpacing="10" RowSpacing="10" Margin="0, 10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<FontIcon Grid.Row="0" Grid.Column="0" Glyph="&#xF133;" FontSize="30"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="No ads" VerticalAlignment="Center"/>
<FontIcon Grid.Row="1" Grid.Column="0" Glyph="&#xE748;" FontSize="30"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="Multiple accounts management" VerticalAlignment="Center"/>
<FontIcon Grid.Row="2" Grid.Column="0" Glyph="&#xE727;" FontSize="30"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="Incognito mode" VerticalAlignment="Center"/>
<FontIcon Grid.Row="3" Grid.Column="0" Glyph="&#xE8CB;" FontSize="30"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="Several downloads at time" VerticalAlignment="Center"/>
<FontIcon Grid.Row="4" Grid.Column="0" Glyph="HQ" FontFamily="Segoe UI" FontSize="30"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="Download videos in higher qualities*" VerticalAlignment="Center"/>
<FontIcon Grid.Row="5" Grid.Column="0" Glyph="&#xF12E;" FontSize="30"/>
<TextBlock Grid.Row="5" Grid.Column="1" Text="Cortana voice commands*" VerticalAlignment="Center"/>
<FontIcon Grid.Row="6" Grid.Column="0" Glyph="&#xE2B1;" FontSize="30"/>
<TextBlock Grid.Row="6" Grid.Column="1" Text="Custom application accent color*" VerticalAlignment="Center"/>
<FontIcon Grid.Row="7" Grid.Column="0" Glyph="&#xF19D;" FontSize="30"/>
<TextBlock Grid.Row="7" Grid.Column="1" Text="Watch videos with you friends with Rooms*" VerticalAlignment="Center"/>
</Grid>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Foreground="Gray" Text="*These features will come in future releases"/>
</StackPanel>
</ContentDialog>
@@ -1,44 +0,0 @@
using FoxTube.Utils;
using System;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Controls.Dialogs
{
public sealed partial class ProOfferDialog : ContentDialog
{
public ProOfferDialog()
{
InitializeComponent();
getButton.Content = $"Get for {AddonsInterop.Price}!";
}
private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) =>
await Purchase();
private async void GetButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
await Purchase();
Hide();
}
private async Task Purchase()
{
if (!await AddonsInterop.PurchaseApp())
return;
ContentDialog dialog = new ContentDialog
{
Title = "Thank you for your purchase!",
Content = "Thanks for purchasing full version of the app (^∇^)\n" +
"In order to complete changes we need to reopen it. Or you can do it later (but some elements may be broken)",
PrimaryButtonText = "Restart",
CloseButtonText = "Later",
DefaultButton = ContentDialogButton.Primary
};
dialog.PrimaryButtonClick += (s, e) => Utils.Utils.RestartApp();
await dialog.ShowAsync();
}
}
}
-76
View File
@@ -1,76 +0,0 @@
<ListViewItem
x:Class="FoxTube.Controls.DownloadListItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
d:DesignHeight="100"
HorizontalContentAlignment="Stretch"
Padding="5">
<ListViewItem.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Text="Delete" Icon="Delete"/>
<MenuFlyoutItem Text="Select">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE762;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</ListViewItem.ContextFlyout>
<controls:DropShadowPanel HorizontalContentAlignment="Stretch">
<Grid Padding="10" ColumnSpacing="10" Background="{ThemeResource SystemChromeLowColor}" CornerRadius="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ImageEx PlaceholderStretch="UniformToFill" CornerRadius="2" Height="75" PlaceholderSource="/Assets/DefaultVideoThumbnail.png"/>
<Border CornerRadius="5,0,0,0" Background="{StaticResource SystemChromeMediumColor}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="10,2">
<TextBlock Text="2:13:45" Style="{StaticResource CaptionTextBlockStyle}"/>
</Border>
<StackPanel Grid.Column="1">
<TextBlock Text="[Quality] Video title" Style="{StaticResource TitleTextBlockStyle}" MaxLines="1"/>
<TextBlock Text="Author" MaxLines="1"/>
<TextBlock Text="video_file_path.mp4" Style="{StaticResource CaptionTextBlockStyle}" MaxLines="1"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" Visibility="Collapsed">
<Button Width="75" Height="75" Padding="0" Background="Transparent">
<StackPanel>
<TextBlock Text="&#xED25;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Open" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center"/>
</StackPanel>
</Button>
<Button Width="75" Height="75" Padding="0" Background="Transparent" Margin="10,0,0,0">
<StackPanel>
<TextBlock Text="&#xE2B4;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Go to original" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
</StackPanel>
<Grid Grid.Column="2" RowSpacing="5" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Downloading..." RelativePanel.Above="progressBar"/>
<TextBlock Text="50%" RelativePanel.AlignRightWithPanel="True" RelativePanel.Above="progressBar" Grid.Column="1" HorizontalAlignment="Right"/>
<ProgressBar Value="50" Width="200" Grid.Row="1" Grid.ColumnSpan="2"/>
<Button Content="&#xE106;" ToolTipService.ToolTip="Cancel" RelativePanel.Below="progressBar" RelativePanel.AlignRightWithPanel="True" Background="Transparent" FontFamily="Segoe MDL2 Assets" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right"/>
</Grid>
</Grid>
</controls:DropShadowPanel>
</ListViewItem>
-14
View File
@@ -1,14 +0,0 @@
using Windows.UI.Xaml.Controls;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace FoxTube.Controls
{
public sealed partial class DownloadListItem : ListViewItem
{
public DownloadListItem()
{
this.InitializeComponent();
}
}
}
-96
View File
@@ -1,96 +0,0 @@
<Grid
x:Class="FoxTube.Controls.ItemsGrid"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
xmlns:models="using:FoxTube.Models"
xmlns:controls1="using:FoxTube.Controls"
mc:Ignorable="d"
d:DesignHeight="1080"
d:DesignWidth="1920">
<TextBlock Text="&#xD8;" FontSize="100" Foreground="Gray" Opacity="0" x:Name="empty" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<controls:AdaptiveGridView x:Name="grid" DesiredWidth="400" Padding="5">
<controls:AdaptiveGridView.ItemContainerTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True"/>
<AddDeleteThemeTransition/>
</TransitionCollection>
</controls:AdaptiveGridView.ItemContainerTransitions>
<!--<controls:AdaptiveGridView.ItemTemplate>
<DataTemplate x:DataType="models:VideoItem">
<Grid RowSpacing="5" CornerRadius="5" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Padding="0,0,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="20"/>
<RowDefinition Height="38"/>
</Grid.RowDefinitions>
<controls:ImageEx PlaceholderStretch="UniformToFill" CornerRadius="5,5,0,0" PlaceholderSource="/Assets/DefaultVideoThumbnail.png" Source="{x:Bind Meta.Snippet.Thumbnails.Maxres.Url}"/>
<StackPanel Padding="5,2,5,3" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" CornerRadius="5" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="5,10">
<TextBlock Text="{x:Bind TimeLabel}" Foreground="Gray" Style="{StaticResource CaptionTextBlockStyle}"/>
</StackPanel>
<StackPanel Padding="5,2,5,3" Background="Red" BorderThickness="1" BorderBrush="White" CornerRadius="5" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="5,35" Opacity="{x:Bind LiveLabelOpacity}">
<FontIcon Glyph="&#xEC44;" VerticalAlignment="Center" Foreground="White" FontSize="12" Margin="0,0,5,0"/>
<TextBlock Text="{x:Bind LiveLabel}" VerticalAlignment="Center" Foreground="White" Style="{StaticResource CaptionTextBlockStyle}" FontWeight="Bold"/>
</StackPanel>
<Grid Grid.Row="1" ColumnSpacing="10" Margin="10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ImageEx CornerRadius="999" BorderThickness="3" BorderBrush="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Background="Red"
Width="50" Height="50" VerticalAlignment="Bottom" Margin="0,-30,0,0" PlaceholderSource="/Assets/Icons/Contact.png" Source="{x:Bind ChannelMeta.LogoUrl}" PlaceholderStretch="UniformToFill"/>
<TextBlock Text="{x:Bind Meta.Snippet.ChannelTitle}" Grid.Column="1" MaxLines="1"/>
<TextBlock Text="{x:Bind ViewsLabel}" Grid.Column="2" MaxLines="1" Foreground="Gray"/>
</Grid>
<TextBlock Margin="10,0" Grid.Row="2" MaxLines="2" Text="{x:Bind Meta.Snippet.Title}" TextWrapping="WrapWholeWords" TextTrimming="CharacterEllipsis"/>
<Grid.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Icon="Play" Text="Play"/>
<MenuFlyoutItem Text="Play incognito">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE727;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Text="Open in picture-in-picture mode">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE2B3;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Icon="Contact" Text="View channel"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem Icon="Link" Text="Copy link"/>
<MenuFlyoutItem Icon="Globe" Text="Open in browser"/>
<MenuFlyoutItem Icon="Share" Text="Share"/>
<MenuFlyoutSeparator/>
<MenuFlyoutSubItem Icon="Download" Text="Download"/>
<MenuFlyoutSubItem Icon="Add" Text="Add to">
<MenuFlyoutItem Text="New playlist" Icon="Add"/>
<ToggleMenuFlyoutItem Text="Watch later" Icon="Clock"/>
<MenuFlyoutSeparator/>
</MenuFlyoutSubItem>
<MenuFlyoutItem Text="Remove from playlist" Icon="Delete" Visibility="Visible" Foreground="Red"/>
</MenuFlyout>
</Grid.ContextFlyout>
</Grid>
</DataTemplate>
</controls:AdaptiveGridView.ItemTemplate>-->
<controls:AdaptiveGridView.Footer>
<ProgressBar IsIndeterminate="True" x:Name="progressBar" Background="Transparent" VerticalAlignment="Bottom"/>
</controls:AdaptiveGridView.Footer>
</controls:AdaptiveGridView>
<controls1:LoadingScreen x:Name="loadingScreen"/>
</Grid>
-30
View File
@@ -1,30 +0,0 @@
using Windows.UI.Xaml.Controls;
using FoxTube.Models;
namespace FoxTube.Controls
{
public sealed partial class ItemsGrid : Grid
{
private ViewItemsCollection ItemsSource
{
get => grid.ItemsSource as ViewItemsCollection;
set => grid.ItemsSource = value;
}
public LoadingScreen LoadingScreen => loadingScreen;
public ItemsGrid() =>
InitializeComponent();
public void Initialize(IIncrementalLoadingHost host)
{
ItemsSource = new ViewItemsCollection(host);
ItemsSource.ItemsUpdated += (s, e) =>
{
empty.Opacity = ItemsSource.Count > 0 ? 0 : 1;
progressBar.IsIndeterminate = ItemsSource.HasMoreItems;
loadingScreen.Hide();
};
}
}
}
-50
View File
@@ -1,50 +0,0 @@
<UserControl
x:Class="FoxTube.Controls.LoadingScreen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
Opacity="1"
Visibility="Visible"
Loaded="UserControl_Loaded">
<UserControl.OpacityTransition>
<ScalarTransition/>
</UserControl.OpacityTransition>
<Grid Background="{ThemeResource AppBarBackgroundThemeBrush}">
<controls:AdaptiveGridView DesiredWidth="400" Padding="5" SelectionMode="None" ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="grid">
<controls:AdaptiveGridView.OpacityTransition>
<ScalarTransition Duration="0:0:2"/>
</controls:AdaptiveGridView.OpacityTransition>
<controls:AdaptiveGridView.ItemContainerTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True"/>
<AddDeleteThemeTransition/>
</TransitionCollection>
</controls:AdaptiveGridView.ItemContainerTransitions>
</controls:AdaptiveGridView>
<StackPanel VerticalAlignment="Center" x:Name="errorPanel" Visibility="Collapsed">
<StackPanel.OpacityTransition>
<ScalarTransition/>
</StackPanel.OpacityTransition>
<FontIcon Glyph="&#xE7BA;" HorizontalAlignment="Center" FontSize="100" x:Name="icon"/>
<TextBlock Text="Hmm... We can't load this page right now" HorizontalAlignment="Center" Style="{StaticResource SubheaderTextBlockStyle}" x:Name="title"/>
<TextBlock Text="There's must be a bug or templorary server issue. Please, try again later" HorizontalAlignment="Center" Style="{StaticResource TitleTextBlockStyle}" x:Name="subtitle"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,20" x:Name="commonErrorActions">
<Button Content="Refresh page" Background="Red" Foreground="White" Click="RefreshPage"/>
<Button Content="Leave feedback" Margin="10,0,0,0" x:Name="feedbackButton" Click="LeaveFeedback"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,20" x:Name="networkErrorActions">
<Button Content="Open network settings" Click="OpenNetworkSettings"/>
<Button Content="Open troubleshooter" Background="Red" Foreground="White" Margin="10,0" Click="OpenTroubleshooter"/>
<Button Content="Refresh page" Click="RefreshPage"/>
</StackPanel>
</StackPanel>
</Grid>
</UserControl>
-116
View File
@@ -1,116 +0,0 @@
using FoxTube.Utils;
using System;
using System.Threading;
using System.Threading.Tasks;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;
namespace FoxTube.Controls
{
public sealed partial class LoadingScreen : UserControl
{
CancellationTokenSource cts = new CancellationTokenSource();
public LoadingScreen() =>
InitializeComponent();
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
feedbackButton.Visibility = FeedbackInterop.HasFeedbackHub ? Visibility.Visible : Visibility.Collapsed;
for (int i = 0; i < 25; i++)
grid.Items.Add(new Image
{
Source = new SvgImageSource("ms-appx:///Assets/Templates/CardTemplate.svg".ToUri())
});
}
private async void Shimmering(CancellationToken token)
{
while (true)
{
grid.Opacity = .75;
await Task.Delay(2000);
if (token.IsCancellationRequested)
break;
grid.Opacity = 1;
await Task.Delay(2000);
if (token.IsCancellationRequested)
break;
}
}
public async void Activate()
{
Visibility = Visibility.Visible;
Opacity = 1;
errorPanel.Opacity = 0;
await Task.Delay(500);
errorPanel.Visibility = Visibility.Collapsed;
cts = new CancellationTokenSource();
Shimmering(cts.Token);
}
public async void Hide()
{
Opacity = 0;
await Task.Delay(500);
Visibility = Visibility.Collapsed;
cts.Cancel();
}
public async void ShowError(bool isInternetError)
{
if (isInternetError)
{
icon.Glyph = "\xEB63";
title.Text = "Hmm... We can't load this page right now";
subtitle.Text = "We can't connect to Internet services. Please, check your connection or try again later";
networkErrorActions.Visibility = Visibility.Visible;
commonErrorActions.Visibility = Visibility.Collapsed;
}
else
{
icon.Glyph = "\xE7BA";
title.Text = "Hmm... Something went wrong";
subtitle.Text = "There's must be a bug or templorary server issue. Please, try again later";
networkErrorActions.Visibility = Visibility.Collapsed;
commonErrorActions.Visibility = Visibility.Visible;
}
cts.Cancel();
Visibility = Visibility.Visible;
Opacity = 1;
grid.Opacity = 0;
await Task.Delay(500);
errorPanel.Visibility = Visibility.Visible;
errorPanel.Opacity = 1;
}
private void LeaveFeedback(object sender, RoutedEventArgs e) =>
FeedbackInterop.OpenFeedbackHub();
private async void OpenNetworkSettings(object sender, RoutedEventArgs e) =>
await Launcher.LaunchUriAsync("ms-settings:network".ToUri());
private void RefreshPage(object sender, RoutedEventArgs e) =>
Navigation.Refresh();
private async void OpenTroubleshooter(object sender, RoutedEventArgs e) =>
await Launcher.LaunchUriAsync("ms-settings:troubleshoot".ToUri());
}
}
@@ -1,37 +0,0 @@
using FoxTube.Models;
using System;
using System.Collections.Generic;
using Windows.UI.Xaml.Data;
namespace FoxTube.Converters
{
public class SubscriptionDataConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
Subscription subscription = (Subscription)value;
List<string> data = new List<string>();
if (subscription.SubscribersCount.HasValue)
data.Add($"{GetTruncatedSubscribersCount(subscription.SubscribersCount)} subscribers");
data.Add($"{subscription.VideosCount} videos");
return string.Join(" • ", data);
}
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
throw new NotImplementedException();
private string GetTruncatedSubscribersCount(ulong? count)
{
if (!count.HasValue)
return "-";
if (count > 1000000)
return Math.Round(count.Value / (double)1000000, 1) + "M";
else if (count > 1000)
return Math.Round(count.Value / (double)1000, 1) + "k";
else
return count.Value.ToString();
}
}
}
+7 -197
View File
@@ -19,14 +19,18 @@
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview> <WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
<PackageCertificateKeyFile>FoxTube_StoreKey.pfx</PackageCertificateKeyFile> <PackageCertificateKeyFile>FoxTube_StoreKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>50B93E6A246058D555BA65CD203D7A02064A7409</PackageCertificateThumbprint> <PackageCertificateThumbprint>
</PackageCertificateThumbprint>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile> <GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision> <AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxPackageDir>E:\XFox\Documents\FoxTube builds\1.2\</AppxPackageDir> <AppxPackageDir>D:\Michael Gordeev\OneDrive\Documents\Projects\FoxTube\Builds\1.9.0\</AppxPackageDir>
<AppxBundle>Always</AppxBundle> <AppxBundle>Always</AppxBundle>
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms> <AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
<AppInstallerUpdateFrequency>1</AppInstallerUpdateFrequency> <AppInstallerUpdateFrequency>0</AppInstallerUpdateFrequency>
<AppInstallerCheckForUpdateFrequency>OnApplicationRun</AppInstallerCheckForUpdateFrequency> <AppInstallerCheckForUpdateFrequency>OnApplicationRun</AppInstallerCheckForUpdateFrequency>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -105,90 +109,10 @@
<Compile Include="App.xaml.cs"> <Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Classes\MenuItemsList.cs" />
<Compile Include="Classes\ScrollPage.cs" />
<Compile Include="Navigation.cs" />
<Compile Include="Classes\ViewItemsCollection.cs" />
<Compile Include="Controls\Dialogs\DownloadVideoDialog.xaml.cs">
<DependentUpon>DownloadVideoDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\Dialogs\ProOfferDialog.xaml.cs">
<DependentUpon>ProOfferDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\DownloadListItem.xaml.cs">
<DependentUpon>DownloadListItem.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\LoadingScreen.xaml.cs">
<DependentUpon>LoadingScreen.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\AccountManager.xaml.cs">
<DependentUpon>AccountManager.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\Cards\PlaylistCard.xaml.cs">
<DependentUpon>PlaylistCard.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\Cards\ChannelCard.xaml.cs">
<DependentUpon>ChannelCard.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\Cards\AdvertCard.xaml.cs">
<DependentUpon>AdvertCard.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\Cards\VideoCard.xaml.cs">
<DependentUpon>VideoCard.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ItemsGrid.xaml.cs">
<DependentUpon>ItemsGrid.xaml</DependentUpon>
</Compile>
<Compile Include="Converters\SubscriptionDataConverter.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SplashScreen.xaml.cs"> <Compile Include="SplashScreen.xaml.cs">
<DependentUpon>SplashScreen.xaml</DependentUpon> <DependentUpon>SplashScreen.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\ChannelView.xaml.cs">
<DependentUpon>ChannelView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\DownloadsView.xaml.cs">
<DependentUpon>DownloadsView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\HistoryView.xaml.cs">
<DependentUpon>HistoryView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\HomeView.xaml.cs">
<DependentUpon>HomeView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\HomeSections\Recommended.xaml.cs">
<DependentUpon>Recommended.xaml</DependentUpon>
</Compile>
<Compile Include="Views\HomeSections\Subscriptions.xaml.cs">
<DependentUpon>Subscriptions.xaml</DependentUpon>
</Compile>
<Compile Include="Views\HomeSections\TrendingView.xaml.cs">
<DependentUpon>TrendingView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PlaylistView.xaml.cs">
<DependentUpon>PlaylistView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SearchView.xaml.cs">
<DependentUpon>SearchView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsSections\AboutSection.xaml.cs">
<DependentUpon>AboutSection.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsSections\PreferencesSection.xaml.cs">
<DependentUpon>PreferencesSection.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsView.xaml.cs">
<DependentUpon>SettingsView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsSections\InboxSection.xaml.cs">
<DependentUpon>InboxSection.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SubscriptionsView.xaml.cs">
<DependentUpon>SubscriptionsView.xaml</DependentUpon>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AppxManifest Include="Package.appxmanifest"> <AppxManifest Include="Package.appxmanifest">
@@ -201,10 +125,7 @@
<Content Include="Assets\BadgeLogo.scale-150.png" /> <Content Include="Assets\BadgeLogo.scale-150.png" />
<Content Include="Assets\BadgeLogo.scale-200.png" /> <Content Include="Assets\BadgeLogo.scale-200.png" />
<Content Include="Assets\BadgeLogo.scale-400.png" /> <Content Include="Assets\BadgeLogo.scale-400.png" />
<Content Include="Assets\DefaultChannelBanner.png" />
<Content Include="Assets\DefaultVideoThumbnail.png" />
<Content Include="Assets\Logo.png" /> <Content Include="Assets\Logo.png" />
<Content Include="Assets\Icons\Contact.png" />
<Content Include="Assets\LargeTile.scale-100.png" /> <Content Include="Assets\LargeTile.scale-100.png" />
<Content Include="Assets\LargeTile.scale-125.png" /> <Content Include="Assets\LargeTile.scale-125.png" />
<Content Include="Assets\LargeTile.scale-150.png" /> <Content Include="Assets\LargeTile.scale-150.png" />
@@ -246,7 +167,6 @@
<Content Include="Assets\StoreLogo.scale-150.png" /> <Content Include="Assets\StoreLogo.scale-150.png" />
<Content Include="Assets\StoreLogo.scale-200.png" /> <Content Include="Assets\StoreLogo.scale-200.png" />
<Content Include="Assets\StoreLogo.scale-400.png" /> <Content Include="Assets\StoreLogo.scale-400.png" />
<Content Include="Assets\Templates\CardTemplate.svg" />
<Content Include="Assets\Wide310x150Logo.scale-100.png" /> <Content Include="Assets\Wide310x150Logo.scale-100.png" />
<Content Include="Assets\Wide310x150Logo.scale-125.png" /> <Content Include="Assets\Wide310x150Logo.scale-125.png" />
<Content Include="Assets\Wide310x150Logo.scale-150.png" /> <Content Include="Assets\Wide310x150Logo.scale-150.png" />
@@ -265,114 +185,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Page Include="Controls\AccountManager.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\Cards\PlaylistCard.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Controls\Cards\ChannelCard.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Controls\Cards\AdvertCard.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Controls\Cards\VideoCard.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\Dialogs\DownloadVideoDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\Dialogs\ProOfferDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\DownloadListItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ItemsGrid.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\LoadingScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ResourceDictionaries\NavigationViewTemplate.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SplashScreen.xaml"> <Page Include="SplashScreen.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\ChannelView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\DownloadsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\HistoryView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\HomeView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\HomeSections\Recommended.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\HomeSections\Subscriptions.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\HomeSections\TrendingView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PlaylistView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SearchView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SettingsSections\AboutSection.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\SettingsSections\PreferencesSection.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\SettingsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SettingsSections\InboxSection.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SubscriptionsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Advertising.XAML"> <PackageReference Include="Microsoft.Advertising.XAML">
@@ -388,12 +204,6 @@
<Version>2.4.2</Version> <Version>2.4.2</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FoxTube.Core\FoxTube.Core.csproj">
<Project>{29c01e10-76e7-4527-984f-b0eef7e1ac64}</Project>
<Name>FoxTube.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<SDKReference Include="Microsoft.Advertising.Xaml, Version=10.0"> <SDKReference Include="Microsoft.Advertising.Xaml, Version=10.0">
<Name>Microsoft Advertising SDK for XAML</Name> <Name>Microsoft Advertising SDK for XAML</Name>
-104
View File
@@ -1,104 +0,0 @@
<Page
x:Class="FoxTube.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:ui="using:Microsoft.UI.Xaml.Controls"
xmlns:controls="using:FoxTube.Controls" xmlns:models="using:FoxTube.Models"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="800"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ToolbarPanel.Margin" Value="0,0,200,0"/>
<Setter Target="AppTitle.Opacity" Value="1"/>
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="550"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="AppTitle.Opacity" Value="1"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.BackgroundTransition>
<BrushTransition/>
</Grid.BackgroundTransition>
<Grid VerticalAlignment="Top" Height="40" Canvas.ZIndex="10" Margin="40,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Width="40" Height="40" CornerRadius="0" Background="Transparent" Click="TogglePane">
<FontIcon Glyph="&#xE700;" FontSize="16"/>
</Button>
<Border Grid.Column="1" x:Name="AppTitleBar" VerticalAlignment="Stretch" Height="40" Background="Transparent">
<TextBlock x:Name="AppTitle" Opacity="0"
VerticalAlignment="Center" Margin="12,0"
Style="{StaticResource CaptionTextBlockStyle}" />
</Border>
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Top" x:Name="ToolbarPanel" Margin="0,0,140,0">
<controls:AccountManager/>
<Button x:Name="FeedbackButton" Click="LeaveFeedback_Click" ToolTipService.ToolTip="Leave feedback"
Content="&#xED15;" Style="{StaticResource HeaderActionButton}"/>
<Button x:Name="RefreshButton" Click="Refresh_Click" Content="&#xE149;" Style="{StaticResource HeaderActionButton}" ToolTipService.ToolTip="Refresh page" Opacity="0">
<Button.OpacityTransition>
<ScalarTransition/>
</Button.OpacityTransition>
</Button>
</StackPanel>
</Grid>
<ui:NavigationView Style="{StaticResource MainPageNavigationView}" x:Name="NavigationViewControl"
IsTitleBarAutoPaddingEnabled="False"
BackRequested="NavigationViewControl_BackRequested"
ItemInvoked="NavigationViewControl_ItemInvoked"
IsPaneToggleButtonVisible="False"
IsPaneOpen="True">
<ui:NavigationView.AutoSuggestBox>
<AutoSuggestBox QueryIcon="Find" PlaceholderText="Search YouTube..." TextChanged="AutoSuggestBox_TextChanged" QuerySubmitted="AutoSuggestBox_QuerySubmitted" TextMemberPath="Text" >
<AutoSuggestBox.ItemTemplate>
<DataTemplate x:DataType="models:SearchSuggestion">
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<FontIcon Glyph="{Binding Icon}"/>
<TextBlock Grid.Column="1" TextTrimming="CharacterEllipsis" Text="{Binding Text}"/>
</Grid>
</DataTemplate>
</AutoSuggestBox.ItemTemplate>
</AutoSuggestBox>
</ui:NavigationView.AutoSuggestBox>
<ui:NavigationView.PaneFooter>
<NavigationViewList>
<NavigationViewItemSeparator/>
<NavigationViewItem Icon="Shop" Content="Get Pro" x:Name="PurchaseButton" Tapped="RemoveAds_Tapped"/>
</NavigationViewList>
</ui:NavigationView.PaneFooter>
<Grid Margin="0,40,0,0">
<Frame x:Name="ContentFrame" x:FieldModifier="public"/>
</Grid>
</ui:NavigationView>
</Grid>
</Page>
-197
View File
@@ -1,197 +0,0 @@
using FoxTube.Attributes;
using FoxTube.Controls.Dialogs;
using FoxTube.Utils;
using FoxTube.Services;
using System;
using System.Linq;
using Windows.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using FoxTube.Models;
using Windows.ApplicationModel;
using Windows.UI.Xaml.Navigation;
using System.Reflection;
using FoxTube.Views;
using Google.Apis.YouTube.v3.Data;
using FoxTube.Views.HomeSections;
namespace FoxTube
{
public sealed partial class MainPage : Windows.UI.Xaml.Controls.Page
{
public static MainPage Current { get; set; }
public MainPage()
{
Current = this;
InitializeComponent();
Window.Current.SetTitleBar(AppTitleBar);
AppTitle.Text = $"{Package.Current.DisplayName} ({Metrics.CurrentVersion})";
PurchaseButton.Visibility = AddonsInterop.AdsDisabled ? Visibility.Collapsed : Visibility.Visible;
if (!AddonsInterop.AdsDisabled)
PurchaseButton.Content += $" ({AddonsInterop.Price})";
if (!FeedbackInterop.HasFeedbackHub)
FeedbackButton.Visibility = Visibility.Collapsed;
Navigation.Navigated += Content_Navigated;
UserService.SubscriptionsChanged += UsersControl_SubscriptionsChanged;
UserService.UserStateUpdated += UsersControl_UserStateUpdated;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
Current = null;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
Uri parameter = (e.Parameter as string)?.ToUri();
if (parameter != null && parameter.Segments.Length > 0)
{
Type targetType = Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(i => i.IsClass && i.Namespace.StartsWith("FoxTube.Views") && i.Name.ToLowerInvariant() == $"{parameter.Segments[0].ToLowerInvariant()}view");
if (targetType != null)
{
Navigation.NavigateTo(targetType, e.Parameter);
return;
}
}
UsersControl_UserStateUpdated(this, UserService.Authorized);
}
#region Navigation
private void Content_Navigated(object sender, NavigationEventArgs args)
{
NavigationViewControl.IsBackEnabled = ContentFrame.CanGoBack;
RefreshButton.Opacity = Convert.ToInt32(Attribute.IsDefined(args.SourcePageType, typeof(RefreshableAttribute)));
NavigationViewControl.SelectedItem = args.SourcePageType.Name switch
{
nameof(SettingsView) => NavigationViewControl.SettingsItem,
nameof(ChannelView) => NavigationViewControl.MenuItems.FirstOrDefault(i => ((FrameworkElement)i).Tag == args.Parameter),
_ => NavigationViewControl.MenuItems.FirstOrDefault(i => ((FrameworkElement)i).Tag as Type == args.SourcePageType)
};
}
private void NavigationViewControl_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
{
Type targetType;
string param = null;
if (args.IsSettingsInvoked)
targetType = typeof(SettingsView);
else
{
if (args.InvokedItemContainer.Tag is Type itemType)
targetType = itemType;
else
{
targetType = typeof(ChannelView);
param = args.InvokedItemContainer.Tag as string;
}
}
if (targetType == typeof(ChannelView))
{
if ((Navigation.CurrentParameter is Channel channelParam && channelParam.Id == param) ||
Navigation.CurrentParameter as string == param)
return;
}
else if (Navigation.CurrentPage == targetType)
return;
if (param == null)
Navigation.NavigateTo(targetType);
else
Navigation.NavigateTo(targetType, param);
}
#endregion
#region Search
private async void AutoSuggestBox_TextChanged(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxTextChangedEventArgs args)
{
if (sender.Text.Length >= 3 && args.Reason == Windows.UI.Xaml.Controls.AutoSuggestionBoxTextChangeReason.UserInput)
sender.ItemsSource = await Search.GetSuggestions(sender.Text);
}
private void AutoSuggestBox_QuerySubmitted(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
{
if (args.QueryText.Length >= 3)
Navigation.NavigateTo(typeof(SearchView), new SearchParameters(args.QueryText));
}
#endregion
#region Users management
private void UsersControl_UserStateUpdated(object sender, bool authorized)
{
UpdateMenu();
return;
// Refresh page
if (ContentFrame.CurrentSourcePageType == null || ContentFrame.CurrentSourcePageType.Name.Belongs("Home", "Trending"))
Navigation.NavigateTo(UserService.Authorized ? typeof(HomeView) : typeof(TrendingView));
else
Navigation.RefreshForce();
}
private void UsersControl_SubscriptionsChanged(object sender, Models.Subscription subscription)
{
NavigationViewItem subscriptionsContainer = NavigationViewControl.MenuItems.Last() as NavigationViewItem;
if (subscriptionsContainer.MenuItems.FirstOrDefault(i => ((NavigationViewItemBase)i).Tag as string == subscription.ChannelId) is NavigationViewItem container)
{
subscriptionsContainer.MenuItems.Remove(container);
if (UserService.CurrentUser.Subscriptions.Count >= 10)
NavigationViewControl.MenuItems.Add(MenuItemsList.GenerateItemFromSubscription(UserService.CurrentUser.Subscriptions[9]));
}
else
{
if (UserService.CurrentUser.Subscriptions.Count.Belongs(1, 10))
NavigationViewControl.MenuItems.Add(MenuItemsList.GenerateItemFromSubscription(subscription));
}
}
public void UpdateMenu()
{
object itemTag = (NavigationViewControl.SelectedItem as NavigationViewItem)?.Tag;
// Add general menu items
NavigationViewControl.SelectedItem = null;
NavigationViewControl.MenuItems.Clear();
MenuItemsList.GetMenuItems(UserService.Authorized).ForEach(i =>
NavigationViewControl.MenuItems.Add(i));
// Add subscriptions list to the menu
if (UserService.Authorized)
UserService.CurrentUser.Subscriptions.ToList().GetRange(0, Math.Min(UserService.CurrentUser.Subscriptions.Count, 10)).ForEach(i =>
(NavigationViewControl.MenuItems.Last() as NavigationViewItem).MenuItems.Add(MenuItemsList.GenerateItemFromSubscription(i)));
NavigationViewControl.SelectedItem = NavigationViewControl.MenuItems.FirstOrDefault(i => (i as NavigationViewItemBase).Tag == itemTag);
}
#endregion
#region Simple button actions
private void NavigationViewControl_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) =>
Navigation.GoBack();
private void Refresh_Click(object sender, RoutedEventArgs e) =>
Navigation.Refresh();
private async void RemoveAds_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) =>
await new ProOfferDialog().ShowAsync();
private void LeaveFeedback_Click(object sender, RoutedEventArgs e) =>
FeedbackInterop.OpenFeedbackHub();
private void TogglePane(object sender, RoutedEventArgs e) =>
NavigationViewControl.IsPaneOpen = !NavigationViewControl.IsPaneOpen;
#endregion
}
}
-45
View File
@@ -1,45 +0,0 @@
using System;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
namespace FoxTube
{
public static class Navigation
{
public static event NavigatedEventHandler Navigated;
public static Type CurrentPage { get; private set; }
public static object CurrentParameter { get; private set; }
public static bool CanRefresh { get; private set; }
public static bool CanGoBack { get; private set; }
public static void NavigateTo(Type view) =>
NavigateTo(view, null, null);
public static void NavigateTo(Type view, object parameters) =>
NavigateTo(view, parameters, new EntranceNavigationTransitionInfo());
public static void NavigateTo(Type view, object parameters, NavigationTransitionInfo transitionInfo)
{
MainPage.Current.ContentFrame.Navigate(view, parameters, transitionInfo);
CurrentPage = view;
CurrentParameter = parameters;
}
public static void Refresh()
{
}
public static void RefreshForce()
{
}
public static void GoBack()
{
}
}
}
+1 -14
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap mp uap3"> <Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap mp uap3">
<Identity Name="53949MichaelXFoxGordeev.FoxTube" Publisher="CN=FD7A34DD-FE4D-4D7D-9D33-2DA9EBBE7725" Version="2.0.1.0" /> <Identity Name="53949MichaelXFoxGordeev.FoxTube" Publisher="CN=FD7A34DD-FE4D-4D7D-9D33-2DA9EBBE7725" Version="1.9.0.0" />
<mp:PhoneIdentity PhoneProductId="04fd81c1-6473-4174-afd7-4ac71dd85721" PhonePublisherId="00000000-0000-0000-0000-000000000000" /> <mp:PhoneIdentity PhoneProductId="04fd81c1-6473-4174-afd7-4ac71dd85721" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties> <Properties>
<DisplayName>FoxTube</DisplayName> <DisplayName>FoxTube</DisplayName>
@@ -24,20 +24,7 @@
</uap:ShowNameOnTiles> </uap:ShowNameOnTiles>
</uap:DefaultTile> </uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#404040" /> <uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#404040" />
<uap:LockScreen Notification="badgeAndTileText" BadgeLogo="Assets\BadgeLogo.png"/>
</uap:VisualElements> </uap:VisualElements>
<Extensions>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="xfox111.foxtube">
<uap:DisplayName>FoxTube</uap:DisplayName>
</uap:Protocol >
</uap:Extension>
</Extensions>
</Application> </Application>
</Applications> </Applications>
<Capabilities>
<Capability Name="internetClient" />
<uap3:Capability Name="backgroundMediaPlayback" />
<uap:Capability Name="videosLibrary" />
</Capabilities>
</Package> </Package>
@@ -1,342 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube"
xmlns:controls="using:Microsoft.UI.Xaml.Controls">
<Style x:Key="NavigationBackButtonNormalStyle" TargetType="Button">
<Setter Property="Background" Value="{ThemeResource NavigationViewBackButtonBackground}"/>
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Height" Value="{ThemeResource NavigationBackButtonHeight}"/>
<Setter Property="Width" Value="{ThemeResource NavigationBackButtonWidth}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}"/>
<Setter Property="Content" Value="&#xE72B;"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonBackgroundPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundPointerOver}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonBackgroundPressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundPressed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundDisabled}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<FontIcon x:Name="Content" AutomationProperties.AccessibilityView="Raw" FontFamily="{TemplateBinding FontFamily}" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" Glyph="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" MirroredWhenRightToLeft="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MainPageNavigationView" TargetType="controls:NavigationView">
<Setter Property="PaneToggleButtonStyle" Value="{StaticResource PaneToggleButtonStyle}"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="CompactPaneLength" Value="{ThemeResource NavigationViewCompactPaneLength}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:NavigationView">
<Grid x:Name="RootGrid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DisplayModeGroup">
<VisualState x:Name="Compact"/>
<!--<VisualState x:Name="Expanded">
<VisualState.Setters>
<Setter Target="RootSplitView.PaneBackground" Value="{ThemeResource NavigationViewExpandedPaneBackground}"/>
</VisualState.Setters>
</VisualState>-->
<VisualState x:Name="Minimal">
<VisualState.Setters>
<Setter Target="HeaderContent.Margin" Value="{ThemeResource NavigationViewMinimalHeaderMargin}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="TopNavigationMinimal"/>
<VisualState x:Name="MinimalWithBackButton">
<VisualState.Setters>
<Setter Target="HeaderContent.Margin" Value="{ThemeResource NavigationViewMinimalHeaderMargin}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="TogglePaneGroup">
<VisualState x:Name="TogglePaneButtonVisible"/>
<VisualState x:Name="TogglePaneButtonCollapsed"/>
</VisualStateGroup>
<VisualStateGroup x:Name="HeaderGroup">
<VisualState x:Name="HeaderVisible"/>
<VisualState x:Name="HeaderCollapsed">
<VisualState.Setters>
<Setter Target="HeaderContent.Visibility" Value="Collapsed"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SettingsGroup">
<VisualState x:Name="SettingsVisible"/>
<VisualState x:Name="SettingsCollapsed">
<VisualState.Setters>
<Setter Target="SettingsNavPaneItem.Visibility" Value="Collapsed"/>
<Setter Target="SettingsTopNavPaneItem.Visibility" Value="Collapsed"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="AutoSuggestGroup">
<VisualState x:Name="AutoSuggestBoxVisible"/>
<VisualState x:Name="AutoSuggestBoxCollapsed">
<VisualState.Setters>
<Setter Target="AutoSuggestArea.Visibility" Value="Collapsed"/>
<Setter Target="TopPaneAutoSuggestArea.Visibility" Value="Collapsed"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="PaneStateGroup">
<VisualState x:Name="NotClosedCompact"/>
<VisualState x:Name="ClosedCompact">
<VisualState.Setters>
<Setter Target="PaneAutoSuggestBoxPresenter.Visibility" Value="Collapsed"/>
<Setter Target="PaneAutoSuggestButton.Visibility" Value="Visible"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="PaneStateListSizeGroup">
<VisualState x:Name="ListSizeFull"/>
<VisualState x:Name="ListSizeCompact">
<VisualState.Setters>
<Setter Target="PaneContentGrid.Width" Value="{Binding CompactPaneLength, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Setter Target="SettingsNavPaneItem.HorizontalAlignment" Value="Left"/>
<Setter Target="PaneTitleTextBlock.Visibility" Value="Collapsed"/>
<Setter Target="PaneHeaderContentBorder.Visibility" Value="Collapsed"/>
<Setter Target="PaneCustomContentBorder.HorizontalAlignment" Value="Left"/>
<Setter Target="FooterContentBorder.HorizontalAlignment" Value="Left"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="TitleBarVisibilityGroup">
<VisualState x:Name="TitleBarVisible"/>
<VisualState x:Name="TitleBarCollapsed">
<VisualState.Setters>
<Setter Target="PaneContentGrid.Margin" Value="0,32,0,0"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="OverflowLabelGroup">
<VisualState x:Name="OverflowButtonWithLabel"/>
<VisualState x:Name="OverflowButtonNoLabel">
<VisualState.Setters>
<Setter Target="TopNavOverflowButton.Style" Value="{ThemeResource NavigationViewOverflowButtonNoLabelStyleWhenPaneOnTop}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="BackButtonGroup">
<VisualState x:Name="BackButtonVisible"/>
<VisualState x:Name="BackButtonCollapsed">
<VisualState.Setters>
<Setter Target="BackButtonPlaceholderOnTopNav.Width" Value="0"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="PaneVisibilityGroup">
<VisualState x:Name="PaneVisible"/>
<VisualState x:Name="PaneCollapsed">
<VisualState.Setters>
<Setter Target="RootSplitView.CompactPaneLength" Value="0"/>
<Setter Target="PaneToggleButtonGrid.Visibility" Value="Collapsed"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="PaneToggleButtonGrid" HorizontalAlignment="Left" Margin="0,0,0,8" VerticalAlignment="Top" Canvas.ZIndex="100">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid x:Name="TogglePaneTopPadding" Height="{Binding TemplateSettings.TopPadding, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Grid x:Name="ButtonHolderGrid" Grid.Row="1">
<Button x:Name="NavigationViewBackButton" IsEnabled="{TemplateBinding IsBackEnabled}" Style="{StaticResource NavigationBackButtonNormalStyle}" VerticalAlignment="Top" Visibility="{Binding TemplateSettings.BackButtonVisibility, RelativeSource={RelativeSource Mode=TemplatedParent}}">
<ToolTipService.ToolTip>
<ToolTip x:Name="NavigationViewBackButtonToolTip"/>
</ToolTipService.ToolTip>
</Button>
<Button x:Name="NavigationViewCloseButton" Style="{StaticResource NavigationBackButtonNormalStyle}" VerticalAlignment="Top">
<ToolTipService.ToolTip>
<ToolTip x:Name="NavigationViewCloseButtonToolTip"/>
</ToolTipService.ToolTip>
</Button>
<Button x:Name="TogglePaneButton" HorizontalAlignment="Center" AutomationProperties.LandmarkType="Navigation" Style="{TemplateBinding PaneToggleButtonStyle}" VerticalAlignment="Top" Visibility="{Binding TemplateSettings.PaneToggleButtonVisibility, RelativeSource={RelativeSource Mode=TemplatedParent}}">
<TextBlock x:Name="PaneTitleTextBlock" Grid.Column="0" HorizontalAlignment="Left" Style="{StaticResource NavigationViewItemHeaderTextStyle}" Text="{TemplateBinding PaneTitle}" VerticalAlignment="Center"/>
</Button>
<Grid x:Name="PaneTitleHolder" Visibility="Collapsed">
<ContentControl x:Name="PaneTitlePresenter" HorizontalContentAlignment="Stretch" IsTabStop="False" Margin="{ThemeResource NavigationViewPaneTitlePresenterMargin}" VerticalContentAlignment="Stretch"/>
</Grid>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="TopNavArea" Background="{ThemeResource NavigationViewTopPaneBackground}" HorizontalAlignment="Stretch" Grid.Row="0" VerticalAlignment="Top" XYFocusKeyboardNavigation="Enabled" Canvas.ZIndex="1">
<Grid x:Name="TopNavTopPadding" Height="{Binding TemplateSettings.TopPadding, RelativeSource={RelativeSource Mode=TemplatedParent}}" Visibility="{Binding TemplateSettings.TopPaneVisibility, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Grid x:Name="TopNavGrid" Height="{ThemeResource NavigationViewTopPaneHeight}" Visibility="{Binding TemplateSettings.TopPaneVisibility, RelativeSource={RelativeSource Mode=TemplatedParent}}">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="BackButtonPlaceholderOnTopNav" Width="{ThemeResource NavigationBackButtonWidth}"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition MinWidth="48" Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid x:Name="TopNavLeftPadding" Grid.Column="1" Width="0"/>
<ContentControl x:Name="PaneHeaderOnTopPane" Grid.Column="2" HorizontalContentAlignment="Stretch" IsTabStop="False" VerticalContentAlignment="Stretch"/>
<ContentControl x:Name="PaneTitleOnTopPane" Grid.Column="2" HorizontalContentAlignment="Stretch" IsTabStop="False" VerticalContentAlignment="Stretch"/>
<controls:ItemsRepeaterScrollHost Grid.Column="3">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" HorizontalScrollMode="Disabled" VerticalScrollMode="Disabled" VerticalScrollBarVisibility="Hidden">
<controls:ItemsRepeater x:Name="TopNavMenuItemsHost" AutomationProperties.AccessibilityView="Content" AutomationProperties.LandmarkType="Navigation" AutomationProperties.Name="{TemplateBinding AutomationProperties.Name}">
<controls:ItemsRepeater.Layout>
<controls:StackLayout Orientation="Horizontal"/>
</controls:ItemsRepeater.Layout>
</controls:ItemsRepeater>
</ScrollViewer>
</controls:ItemsRepeaterScrollHost>
<Button x:Name="TopNavOverflowButton" Content="More" Grid.Column="4" Style="{StaticResource NavigationViewOverflowButtonStyleWhenPaneOnTop}" Visibility="{Binding TemplateSettings.OverflowButtonVisibility, RelativeSource={RelativeSource Mode=TemplatedParent}}">
<Button.Flyout>
<Flyout ElementSoundMode="{Binding ElementSoundMode, RelativeSource={RelativeSource Mode=TemplatedParent}}" Placement="Bottom">
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="Padding" Value="0,8"/>
<Setter Property="Margin" Value="0,-4,0,0"/>
</Style>
</Flyout.FlyoutPresenterStyle>
<controls:ItemsRepeaterScrollHost>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<controls:ItemsRepeater x:Name="TopNavMenuItemsOverflowHost" AutomationProperties.AccessibilityView="Content">
<controls:ItemsRepeater.Layout>
<controls:StackLayout Orientation="Vertical"/>
</controls:ItemsRepeater.Layout>
</controls:ItemsRepeater>
</ScrollViewer>
</controls:ItemsRepeaterScrollHost>
</Flyout>
</Button.Flyout>
</Button>
<ContentControl x:Name="PaneCustomContentOnTopPane" Grid.Column="5" HorizontalContentAlignment="Stretch" IsTabStop="False" VerticalContentAlignment="Stretch"/>
<Grid x:Name="TopPaneAutoSuggestArea" Grid.Column="6" Height="{ThemeResource NavigationViewTopPaneHeight}">
<ContentControl x:Name="TopPaneAutoSuggestBoxPresenter" HorizontalContentAlignment="Stretch" IsTabStop="False" MinWidth="48" Margin="12,0,12,0" VerticalContentAlignment="Center"/>
</Grid>
<ContentControl x:Name="PaneFooterOnTopPane" Grid.Column="7" HorizontalContentAlignment="Stretch" IsTabStop="False" VerticalContentAlignment="Stretch"/>
<Grid Grid.Column="8">
<controls:NavigationViewItem x:Name="SettingsTopNavPaneItem" Style="{ThemeResource MUX_NavigationViewSettingsItemStyleWhenOnTopPane}">
<controls:NavigationViewItem.Icon>
<SymbolIcon Symbol="Setting"/>
</controls:NavigationViewItem.Icon>
</controls:NavigationViewItem>
</Grid>
</Grid>
<Border x:Name="TopNavContentOverlayAreaGrid" Child="{TemplateBinding ContentOverlay}"/>
</StackPanel>
<SplitView x:Name="RootSplitView" Background="{Binding Background}" CompactPaneLength="{TemplateBinding CompactPaneLength}" DisplayMode="Inline" IsTabStop="False" IsPaneOpen="{Binding IsPaneOpen, Mode=TwoWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" OpenPaneLength="{TemplateBinding OpenPaneLength}" Grid.Row="1">
<SplitView.PaneBackground>
<AcrylicBrush BackgroundSource="HostBackdrop" TintOpacity=".8" TintColor="{ThemeResource SystemChromeHighColor}" FallbackColor="{ThemeResource SystemChromeHighColor}"/>
</SplitView.PaneBackground>
<SplitView.Pane>
<Grid x:Name="PaneContentGrid" HorizontalAlignment="Left" Visibility="{Binding TemplateSettings.LeftPaneVisibility, RelativeSource={RelativeSource Mode=TemplatedParent}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0"/>
<RowDefinition x:Name="PaneContentGridToggleButtonRow" Height="Auto" MinHeight="{StaticResource NavigationViewPaneHeaderRowMinHeight}"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="8"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="8"/>
</Grid.RowDefinitions>
<Grid x:Name="ContentPaneTopPadding" Height="{Binding TemplateSettings.TopPadding, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="PaneHeaderCloseButtonColumn"/>
<ColumnDefinition x:Name="PaneHeaderToggleButtonColumn"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition x:Name="PaneHeaderContentBorderRow"/>
</Grid.RowDefinitions>
<ContentControl x:Name="PaneHeaderContentBorder" Grid.Column="2" HorizontalContentAlignment="Stretch" IsTabStop="False" VerticalContentAlignment="Stretch"/>
</Grid>
<Grid x:Name="AutoSuggestArea" Height="{ThemeResource NavigationViewTopPaneHeight}" Grid.Row="3" VerticalAlignment="Center">
<ContentControl x:Name="PaneAutoSuggestBoxPresenter" HorizontalContentAlignment="Stretch" IsTabStop="False" Margin="{ThemeResource NavigationViewAutoSuggestBoxMargin}" VerticalContentAlignment="Center"/>
<Button x:Name="PaneAutoSuggestButton" Style="{ThemeResource NavigationViewPaneSearchButtonStyle}" Visibility="Collapsed" Width="{TemplateBinding CompactPaneLength}"/>
</Grid>
<ContentControl x:Name="PaneCustomContentBorder" HorizontalContentAlignment="Stretch" IsTabStop="False" Grid.Row="4" VerticalContentAlignment="Stretch"/>
<controls:ItemsRepeaterScrollHost HorizontalAlignment="Stretch" Margin="0,0,0,20" Grid.Row="6" VerticalAlignment="Top">
<ScrollViewer TabNavigation="Once" VerticalScrollBarVisibility="Auto">
<controls:ItemsRepeater x:Name="MenuItemsHost" AutomationProperties.AccessibilityView="Content" AutomationProperties.Name="{TemplateBinding AutomationProperties.Name}">
<controls:ItemsRepeater.Layout>
<controls:StackLayout Orientation="Vertical"/>
</controls:ItemsRepeater.Layout>
</controls:ItemsRepeater>
</ScrollViewer>
</controls:ItemsRepeaterScrollHost>
<ContentControl x:Name="FooterContentBorder" HorizontalContentAlignment="Stretch" IsTabStop="False" Grid.Row="7" VerticalContentAlignment="Stretch"/>
<Grid Grid.Row="8">
<controls:NavigationViewItem x:Name="SettingsNavPaneItem">
<controls:NavigationViewItem.Icon>
<SymbolIcon Symbol="Setting"/>
</controls:NavigationViewItem.Icon>
</controls:NavigationViewItem>
</Grid>
</Grid>
</SplitView.Pane>
<Grid x:Name="ContentGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="ContentTopPadding" Grid.ColumnSpan="2" Height="{Binding TemplateSettings.TopPadding, RelativeSource={RelativeSource Mode=TemplatedParent}}" Visibility="{Binding TemplateSettings.LeftPaneVisibility, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Grid x:Name="ContentLeftPadding" Grid.Row="1"/>
<ContentControl x:Name="HeaderContent" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" HorizontalContentAlignment="Stretch" IsTabStop="False" MinHeight="{StaticResource PaneToggleButtonHeight}" Grid.Row="1" Style="{StaticResource NavigationViewTitleHeaderContentControlTextStyle}" VerticalContentAlignment="Stretch"/>
<ContentPresenter Content="{TemplateBinding Content}" Grid.ColumnSpan="2" AutomationProperties.LandmarkType="Main" Grid.Row="2"/>
</Grid>
</SplitView>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
+10 -2
View File
@@ -6,7 +6,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource SplashScreenBackground}" Background="{ThemeResource SplashScreenBackground}"
mc:Ignorable="d" mc:Ignorable="d"
Loaded="Page_Loaded"> Loaded="Page_Loaded"
RequestedTheme="Dark">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -18,6 +19,13 @@
<Image x:Name="SplashScreenImage" Source="/Assets/SplashScreen.png" /> <Image x:Name="SplashScreenImage" Source="/Assets/SplashScreen.png" />
</Canvas> </Canvas>
<ProgressRing x:Name="ProgressRingControl" Grid.Row="1" Width="50" Height="50" /> <StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Opacity="0" Name="caption">
<StackPanel.OpacityTransition>
<ScalarTransition/>
</StackPanel.OpacityTransition>
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="Sorry, the application is unavailable now" Grid.Row="1" HorizontalAlignment="Center"/>
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="Estimated relaunch date: August 14th 2020. Stay tuned" HorizontalAlignment="Center"/>
<Button Content="Follow me on @xfox111" Margin="0, 10" HorizontalAlignment="Center" Click="OpenTwitter"/>
</StackPanel>
</Grid> </Grid>
</Page> </Page>
+20 -41
View File
@@ -1,11 +1,11 @@
using FoxTube.Services; using System;
using FoxTube.Utils;
using System;
using Windows.ApplicationModel.Activation; using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Core; using Windows.ApplicationModel.Core;
using Windows.System;
using Windows.UI;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation; using Windows.UI.Xaml.Navigation;
namespace FoxTube namespace FoxTube
@@ -16,13 +16,11 @@ namespace FoxTube
public sealed partial class SplashScreen : Page public sealed partial class SplashScreen : Page
{ {
private readonly Windows.ApplicationModel.Activation.SplashScreen splashScreen; private readonly Windows.ApplicationModel.Activation.SplashScreen splashScreen;
private readonly string navigationParameter;
public SplashScreen(IActivatedEventArgs args, string parameter = null) public SplashScreen(IActivatedEventArgs args)
{ {
InitializeComponent(); InitializeComponent();
splashScreen = args.SplashScreen; splashScreen = args.SplashScreen;
navigationParameter = parameter;
Window.Current.SizeChanged += Current_SizeChanged; Window.Current.SizeChanged += Current_SizeChanged;
@@ -31,44 +29,20 @@ namespace FoxTube
private void Page_Loaded(object sender, RoutedEventArgs e) private void Page_Loaded(object sender, RoutedEventArgs e)
{ {
ProgressRingControl.IsActive = true; caption.Opacity = 1;
Initialize(); ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
} titleBar.ButtonBackgroundColor = Colors.Transparent;
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
titleBar.ButtonInactiveForegroundColor = Colors.Gray;
public async void Initialize() titleBar.ButtonForegroundColor =
{ titleBar.ButtonHoverForegroundColor =
Frame frame = Window.Current.Content as Frame; titleBar.ButtonPressedForegroundColor = Colors.White;
titleBar.ButtonHoverBackgroundColor = Color.FromArgb(50, 255, 255, 255);
frame.RequestedTheme = SettingsService.Theme; titleBar.ButtonPressedBackgroundColor = Color.FromArgb(30, 255, 255, 255);
if (frame.RequestedTheme == ElementTheme.Default)
Utils.Utils.UpdateTitleBarTheme(Application.Current.RequestedTheme == ApplicationTheme.Dark);
else
Utils.Utils.UpdateTitleBarTheme(frame.RequestedTheme == ElementTheme.Dark);
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
if (StorageService.PromptReview)
FeedbackInterop.PromptReview();
if (StorageService.PromptFeedback)
FeedbackInterop.PromptFeedback();
#region App init
await UserService.Initialize();
await DownloadsService.Initialize();
await AddonsInterop.UpdateProPurchasedState();
InboxService.PushChangelog();
BackgroundManager.RegisterBackgroundTasks();
#endregion
if (navigationParameter.ToUri() is Uri uri && uri.Segments.Length > 0)
{
if (uri.Segments[0].ToLowerInvariant() == "action")
await BackgroundManager.ProcessBackgroundAction(navigationParameter);
}
frame.Navigate(typeof(MainPage), navigationParameter, new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromLeft });
} }
protected override void OnNavigatedFrom(NavigationEventArgs e) protected override void OnNavigatedFrom(NavigationEventArgs e)
@@ -87,5 +61,10 @@ namespace FoxTube
SplashScreenImage.Height = splashScreen.ImageLocation.Height; SplashScreenImage.Height = splashScreen.ImageLocation.Height;
SplashScreenImage.Width = splashScreen.ImageLocation.Width; SplashScreenImage.Width = splashScreen.ImageLocation.Width;
} }
private async void OpenTwitter(object sender, RoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new Uri("https://twitter.com/xfox111"));
}
} }
} }
-14
View File
@@ -1,14 +0,0 @@
<Page
x:Class="FoxTube.Views.ChannelView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
</Grid>
</Page>
-30
View File
@@ -1,30 +0,0 @@
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;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class ChannelView : Page
{
public ChannelView()
{
this.InitializeComponent();
}
}
}
-365
View File
@@ -1,365 +0,0 @@
<Page
x:Class="FoxTube.Views.DownloadsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
xmlns:models="using:FoxTube.Models"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Pivot>
<Pivot.RightHeader>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="32"/>
</Style>
<Style TargetType="ToggleButton" BasedOn="{StaticResource ToggleButtonRevealStyle}">
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="32"/>
</Style>
</StackPanel.Resources>
<Button Content="&#xE107;" ToolTipService.ToolTip="Delete" Name="deleteItemsButton" IsEnabled="False" Visibility="Collapsed">
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock Text="Are you sure? This action cannot be undone"/>
<CheckBox Content="Also delete downloaded files" x:Name="deleteFilesCheckbox"/>
<Button Content="Delete" Background="Red" FontFamily="White" Click="DeleteSelectedItems"/>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
<ToggleButton Content="&#xE762;" ToolTipService.ToolTip="Selecttion mode" Margin="10,0" Checked="ToggleButton_Checked" Unchecked="ToggleButton_Unchecked"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="Open folder" Margin="10,0" Click="OpenDefaultFolder"/>
<Button Content="&#xE115;" Width="32" ToolTipService.ToolTip="Downloads settings" FontFamily="Segoe MDL2 Assets" Click="OpenDownloadSettings"/>
<AutoSuggestBox QueryIcon="Add" PlaceholderText="Download video by URL or ID" Width="300" Margin="10" QuerySubmitted="AutoSuggestBox_QuerySubmitted" TextChanged="AutoSuggestBox_TextChanged"/>
</StackPanel>
</StackPanel>
</Pivot.RightHeader>
<PivotItem Header="Downloads">
<Grid>
<StackPanel VerticalAlignment="Center" x:Name="empty" Margin="10">
<StackPanel.OpacityTransition>
<ScalarTransition/>
</StackPanel.OpacityTransition>
<TextBlock TextAlignment="Center" Text="You haven't downloaded anything yet" Style="{StaticResource SubheaderTextBlockStyle}"/>
<TextBlock TextAlignment="Center" Text="To download video press &quot;Download&quot; button from video page or a video card context menu and select download quality" Style="{StaticResource SubtitleTextBlockStyle}"/>
</StackPanel>
<ScrollViewer>
<StackPanel>
<ListView x:Name="downloadHistoryList" SelectionChanged="List_SelectionChanged" SelectionMode="None">
<ListView.ItemContainerTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True"/>
<AddDeleteThemeTransition/>
</TransitionCollection>
</ListView.ItemContainerTransitions>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="ContextFlyout">
<Setter.Value>
<MenuFlyout>
<MenuFlyoutItem Text="Delete" Icon="Delete" Click="DeleteOneItem"/>
<MenuFlyoutItem Text="Select" Click="SelectOneItem">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE762;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Text="Show in folder" Click="ShowInFolder">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE19C;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:SavedVideo">
<controls:DropShadowPanel HorizontalContentAlignment="Stretch">
<Grid Padding="10" ColumnSpacing="10" Background="{ThemeResource SystemChromeLowColor}" CornerRadius="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ImageEx PlaceholderStretch="UniformToFill" CornerRadius="2" Height="75" PlaceholderSource="/Assets/DefaultVideoThumbnail.png" Source="{x:Bind Thumbnail}"/>
<Border CornerRadius="5,0,0,0" Background="{StaticResource SystemChromeMediumColor}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="10,2">
<TextBlock Text="{x:Bind Duration}" Style="{StaticResource CaptionTextBlockStyle}"/>
</Border>
<StackPanel Grid.Column="1">
<TextBlock Text="{x:Bind Title}" Style="{StaticResource TitleTextBlockStyle}" MaxLines="1"/>
<TextBlock Text="{x:Bind Author}" MaxLines="1"/>
<TextBlock Text="{x:Bind Path}" Style="{StaticResource CaptionTextBlockStyle}" MaxLines="1"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" Tag="{x:Bind}">
<Button Width="75" Height="75" Padding="0" Background="Transparent" Click="OpenVideo">
<StackPanel>
<TextBlock Text="&#xED25;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Open" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center"/>
</StackPanel>
</Button>
<Button Width="75" Height="75" Padding="0" Background="Transparent" Margin="10,0,0,0" Click="OpenOriginal">
<StackPanel>
<TextBlock Text="&#xE2B4;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Go to original" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</controls:DropShadowPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ListView x:Name="list" SelectionChanged="List_SelectionChanged" SelectionMode="None">
<ListView.ItemContainerTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True"/>
<AddDeleteThemeTransition/>
</TransitionCollection>
</ListView.ItemContainerTransitions>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="ContextFlyout">
<Setter.Value>
<MenuFlyout>
<MenuFlyoutItem Text="Delete" Icon="Delete" Click="DeleteOneItem"/>
<MenuFlyoutItem Text="Select" Click="SelectOneItem">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE762;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Text="Show in folder" Click="SelectOneItem">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE19C;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:DownloadItem">
<controls:DropShadowPanel HorizontalContentAlignment="Stretch">
<Grid Padding="10" ColumnSpacing="10" Background="{ThemeResource SystemChromeLowColor}" CornerRadius="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ImageEx PlaceholderStretch="UniformToFill" CornerRadius="2" Height="75" PlaceholderSource="/Assets/DefaultVideoThumbnail.png" Source="{x:Bind Thumbnail}"/>
<Border CornerRadius="5,0,0,0" Background="{StaticResource SystemChromeMediumColor}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="10,2">
<TextBlock Text="{x:Bind Duration}" Style="{StaticResource CaptionTextBlockStyle}"/>
</Border>
<StackPanel Grid.Column="1">
<TextBlock Text="{x:Bind Title}" Style="{StaticResource TitleTextBlockStyle}" MaxLines="1"/>
<TextBlock Text="{x:Bind Author}" MaxLines="1"/>
<TextBlock Text="{x:Bind Path}" Style="{StaticResource CaptionTextBlockStyle}" MaxLines="1"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" Visibility="Collapsed">
<Button Width="75" Height="75" Padding="0" Background="Transparent">
<StackPanel>
<TextBlock Text="&#xED25;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Open" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center"/>
</StackPanel>
</Button>
<Button Width="75" Height="75" Padding="0" Background="Transparent" Margin="10,0,0,0">
<StackPanel>
<TextBlock Text="&#xE2B4;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Go to original" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
</StackPanel>
<Grid Grid.Column="2" RowSpacing="5" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Downloading..." RelativePanel.Above="progressBar"/>
<TextBlock Text="50%" RelativePanel.AlignRightWithPanel="True" RelativePanel.Above="progressBar" Grid.Column="1" HorizontalAlignment="Right"/>
<ProgressBar Value="50" Width="200" Grid.Row="1" Grid.ColumnSpan="2"/>
<Button Content="&#xE106;" ToolTipService.ToolTip="Cancel" RelativePanel.Below="progressBar" RelativePanel.AlignRightWithPanel="True" Background="Transparent" FontFamily="Segoe MDL2 Assets" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right"/>
</Grid>
</Grid>
</controls:DropShadowPanel>
</DataTemplate>
</ListView.ItemTemplate>
<ListViewItem HorizontalContentAlignment="Stretch" Padding="5">
<ListViewItem.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Text="Delete" Icon="Delete"/>
<MenuFlyoutItem Text="Select">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE762;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</ListViewItem.ContextFlyout>
<controls:DropShadowPanel HorizontalContentAlignment="Stretch">
<Grid Padding="10" ColumnSpacing="10" Background="{ThemeResource SystemChromeLowColor}" CornerRadius="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ImageEx PlaceholderStretch="UniformToFill" CornerRadius="2" Height="75" PlaceholderSource="/Assets/DefaultVideoThumbnail.png"/>
<Border CornerRadius="5,0,0,0" Background="{StaticResource SystemChromeMediumColor}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="10,2">
<TextBlock Text="2:13:45" Style="{StaticResource CaptionTextBlockStyle}"/>
</Border>
<StackPanel Grid.Column="1">
<TextBlock Text="[Quality] Video title" Style="{StaticResource TitleTextBlockStyle}" MaxLines="1"/>
<TextBlock Text="Author" MaxLines="1"/>
<TextBlock Text="video_file_path.mp4" Style="{StaticResource CaptionTextBlockStyle}" MaxLines="1"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" Visibility="Collapsed">
<Button Width="75" Height="75" Padding="0" Background="Transparent">
<StackPanel>
<TextBlock Text="&#xED25;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Open" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center"/>
</StackPanel>
</Button>
<Button Width="75" Height="75" Padding="0" Background="Transparent" Margin="10,0,0,0">
<StackPanel>
<TextBlock Text="&#xE2B4;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Go to original" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
</StackPanel>
<Grid Grid.Column="2" RowSpacing="5" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Downloading..." RelativePanel.Above="progressBar"/>
<TextBlock Text="50%" RelativePanel.AlignRightWithPanel="True" RelativePanel.Above="progressBar" Grid.Column="1" HorizontalAlignment="Right"/>
<ProgressBar Value="50" Width="200" Grid.Row="1" Grid.ColumnSpan="2"/>
<Button Content="&#xE106;" ToolTipService.ToolTip="Cancel" RelativePanel.Below="progressBar" RelativePanel.AlignRightWithPanel="True" Background="Transparent" FontFamily="Segoe MDL2 Assets" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right"/>
</Grid>
</Grid>
</controls:DropShadowPanel>
</ListViewItem>
<ListViewItem HorizontalContentAlignment="Stretch" Padding="5">
<ListViewItem.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Text="Delete" Icon="Delete"/>
<MenuFlyoutItem Text="Select">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE762;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</ListViewItem.ContextFlyout>
<controls:DropShadowPanel HorizontalContentAlignment="Stretch">
<Grid Padding="10" ColumnSpacing="10" Background="{ThemeResource SystemChromeLowColor}" CornerRadius="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ImageEx PlaceholderStretch="UniformToFill" CornerRadius="2" Height="75" PlaceholderSource="/Assets/DefaultVideoThumbnail.png"/>
<Border CornerRadius="5,0,0,0" Background="{StaticResource SystemChromeMediumColor}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="10,2">
<TextBlock Text="2:13:45" Style="{StaticResource CaptionTextBlockStyle}"/>
</Border>
<StackPanel Grid.Column="1">
<TextBlock Text="[Quality] Video title" Style="{StaticResource TitleTextBlockStyle}" MaxLines="1"/>
<TextBlock Text="Author" MaxLines="1"/>
<TextBlock Text="video_file_path.mp4" Style="{StaticResource CaptionTextBlockStyle}" MaxLines="1"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" Visibility="Visible">
<Button Width="75" Height="75" Padding="0" Background="Transparent">
<StackPanel>
<TextBlock Text="&#xED25;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Open" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center"/>
</StackPanel>
</Button>
<Button Width="75" Height="75" Padding="0" Background="Transparent" Margin="10,0,0,0">
<StackPanel>
<TextBlock Text="&#xE2B4;" FontFamily="Segoe MDL2 Assets" FontSize="30" HorizontalAlignment="Center"/>
<TextBlock Text="Go to original" TextWrapping="WrapWholeWords" HorizontalTextAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
</StackPanel>
<Grid Grid.Column="2" RowSpacing="5" VerticalAlignment="Center" Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Downloading..." RelativePanel.Above="progressBar"/>
<TextBlock Text="50%" RelativePanel.AlignRightWithPanel="True" RelativePanel.Above="progressBar" Grid.Column="1" HorizontalAlignment="Right"/>
<ProgressBar Value="50" Width="200" Grid.Row="1" Grid.ColumnSpan="2"/>
<Button Content="&#xE106;" ToolTipService.ToolTip="Cancel" RelativePanel.Below="progressBar" RelativePanel.AlignRightWithPanel="True" Background="Transparent" FontFamily="Segoe MDL2 Assets" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right"/>
</Grid>
</Grid>
</controls:DropShadowPanel>
</ListViewItem>
</ListView>
</StackPanel>
</ScrollViewer>
</Grid>
</PivotItem>
</Pivot>
</Page>
-114
View File
@@ -1,114 +0,0 @@
using FoxTube.Controls.Dialogs;
using FoxTube.Services;
using FoxTube.Models;
using System;
using System.Collections.Generic;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using YoutubeExplode;
using YoutubeExplode.Videos;
using YoutubeExplode.Videos.Streams;
using System.IO;
namespace FoxTube.Views
{
/// <summary>
/// Video download page
/// </summary>
public sealed partial class DownloadsView : Page
{
public DownloadsView()
{
InitializeComponent();
downloadHistoryList.ItemsSource = DownloadsService.History;
// TODO: Add downloads list
UpdateList();
}
private void ToggleButton_Checked(object sender, RoutedEventArgs e)
{
deleteItemsButton.Visibility = Visibility.Visible;
deleteItemsButton.IsEnabled = false;
list.SelectionMode = ListViewSelectionMode.Multiple;
}
private void ToggleButton_Unchecked(object sender, RoutedEventArgs e)
{
deleteItemsButton.Visibility = Visibility.Collapsed;
list.SelectionMode = ListViewSelectionMode.None;
}
private void List_SelectionChanged(object sender, SelectionChangedEventArgs e) =>
deleteItemsButton.IsEnabled = list.SelectedItems.Count > 0;
private void DeleteSelectedItems(object sender, RoutedEventArgs e)
{
// TODO: Delete downloads
}
private async void OpenDefaultFolder(object sender, RoutedEventArgs e) =>
await Launcher.LaunchFolderAsync(await DownloadsService.GetDefaultDownloadsFolder());
private void OpenDownloadSettings(object sender, RoutedEventArgs e) =>
Navigation.NavigateTo(typeof(SettingsView), "downloads");
public void UpdateList() =>
empty.Opacity = (((list.ItemsSource as List<object>)?.Count) ?? list.Items.Count) > 0 ? 0 : 1;
private async void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
YoutubeClient client = new YoutubeClient(UserService.Service.HttpClient);
VideoId? id;
Video meta;
if ((id = VideoId.TryParse(args.QueryText)) == null || (meta = await client.Videos.GetAsync(id.Value)) == null)
{
sender.Items.Clear();
sender.Items.Add(new ComboBoxItem
{
Content = "No video found",
IsEnabled = false
});
return;
}
StreamManifest manifest = await client.Videos.Streams.GetManifestAsync(id.Value);
await new DownloadVideoDialog(meta, manifest).ShowAsync();
}
private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) =>
sender.Items.Clear();
private void DeleteOneItem(object sender, RoutedEventArgs e)
{
}
private void SelectOneItem(object sender, RoutedEventArgs e)
{
object item = ((sender as FrameworkElement).Parent as FrameworkElement).Parent;
ListView list;
}
private void OpenOriginal(object sender, RoutedEventArgs e)
{
SavedVideo item = (sender as FrameworkElement).Parent.GetValue(TagProperty) as SavedVideo;
Navigation.NavigateTo(typeof(SettingsView), item.Id); // TODO: Replace with actual navigation
}
private async void OpenVideo(object sender, RoutedEventArgs e)
{
SavedVideo item = (sender as FrameworkElement).Parent.GetValue(TagProperty) as SavedVideo;
await Launcher.LaunchUriAsync(item.Path.ToUri());
}
private async void ShowInFolder(object sender, RoutedEventArgs e)
{
SavedVideo item = (sender as FrameworkElement).Parent.GetValue(TagProperty) as SavedVideo;
await Launcher.LaunchUriAsync(new FileInfo(item.Path).Directory.FullName.ToUri());
}
}
}
-14
View File
@@ -1,14 +0,0 @@
<Page
x:Class="FoxTube.Views.HistoryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
</Grid>
</Page>
-30
View File
@@ -1,30 +0,0 @@
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;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class HistoryView : Page
{
public HistoryView()
{
this.InitializeComponent();
}
}
}
@@ -1,17 +0,0 @@
<Page
x:Class="FoxTube.Views.HomeSections.Recommended"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:FoxTube.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
Loaded="Page_Loaded">
<Grid>
<RefreshContainer>
<ListView x:Name="list"/>
</RefreshContainer>
<controls:LoadingScreen x:Name="loadingScreen"/>
</Grid>
</Page>
@@ -1,37 +0,0 @@
using FoxTube.Attributes;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace FoxTube.Views.HomeSections
{
/// <summary>
/// Page with videos recommeded to user
/// </summary>
[Refreshable]
public sealed partial class Recommended : Page
{
public Recommended() =>
InitializeComponent();
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.New)
LoadContent();
}
private void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
if (!(Parent is Frame))
LoadContent();
}
private void LoadContent()
{
loadingScreen.Activate();
// TODO: Load content
}
}
}
@@ -1,20 +0,0 @@
<Page
NavigationCacheMode="Enabled"
x:Class="FoxTube.Views.HomeSections.Subscriptions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:FoxTube.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
Loaded="Page_Loaded">
<Grid>
<RefreshContainer>
<ScrollViewer Padding="5,0">
<controls:ItemsGrid x:Name="grid"/>
</ScrollViewer>
</RefreshContainer>
<controls:LoadingScreen x:Name="loadingScreen"/>
</Grid>
</Page>
@@ -1,38 +0,0 @@
using FoxTube.Attributes;
using FoxTube.Controls.Cards;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace FoxTube.Views.HomeSections
{
/// <summary>
/// Users subscriptions videos page
/// </summary>
[Refreshable]
public sealed partial class Subscriptions : Page
{
public Subscriptions() =>
InitializeComponent();
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.New)
LoadContent();
}
private void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
if (!(Parent is Frame))
LoadContent();
}
private void LoadContent()
{
loadingScreen.Activate();
// TODO: Load content
}
}
}
@@ -1,17 +0,0 @@
<Page
NavigationCacheMode="Enabled"
x:Class="FoxTube.Views.HomeSections.TrendingView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:FoxTube.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
Loaded="Page_Loaded">
<Grid>
<RefreshContainer>
<controls:ItemsGrid x:Name="grid"/>
</RefreshContainer>
</Grid>
</Page>
@@ -1,62 +0,0 @@
using FoxTube.Attributes;
using FoxTube.Controls.Cards;
using FoxTube.Models;
using FoxTube.Services;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace FoxTube.Views.HomeSections
{
/// <summary>
/// YouTube trending videos page
/// </summary>
[Refreshable]
public sealed partial class TrendingView : Page, IIncrementalLoadingHost
{
VideosResource.ListRequest client;
public TrendingView() =>
InitializeComponent();
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode != NavigationMode.Back)
LoadContent();
}
private void Page_Loaded(object sender, RoutedEventArgs e)
{
if (!(Parent is Frame))
LoadContent();
}
private void LoadContent()
{
client = UserService.Service.Videos.List("snippet,liveStreamingDetails");
client.MaxResults = 25;
client.Chart = VideosResource.ListRequest.ChartEnum.MostPopular;
//client.RegionCode = FoxTube.Settings.Region;
grid.Initialize(this);
}
public async Task<(List<object>, bool)> LoadMoreItems()
{
VideoListResponse response = await client.ExecuteAsync();
client.PageToken = response.NextPageToken;
return (null, false);
/*return (response.Items.Select(i => new VideoItem(i) as object).ToList(),
!string.IsNullOrWhiteSpace(response.NextPageToken));*/
}
}
}
-22
View File
@@ -1,22 +0,0 @@
<Page
NavigationCacheMode="Enabled"
x:Class="FoxTube.Views.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:homesections="using:FoxTube.Views.HomeSections"
mc:Ignorable="d">
<Pivot x:Name="pivot">
<PivotItem Header="Recommended">
<homesections:Recommended/>
</PivotItem>
<PivotItem Header="Trending">
<homesections:TrendingView/>
</PivotItem>
<PivotItem Header="Subscriptions">
<homesections:Subscriptions/>
</PivotItem>
</Pivot>
</Page>
-28
View File
@@ -1,28 +0,0 @@
using FoxTube.Attributes;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace FoxTube.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
[Refreshable]
public sealed partial class HomeView : Page
{
public HomeView()
{
InitializeComponent();
//pivot.SelectedIndex = FoxTube.Settings.DefaultHomeTab;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
/*if (e.NavigationMode == NavigationMode.New)
pivot.SelectedIndex = FoxTube.Settings.DefaultHomeTab;*/
}
}
}
-14
View File
@@ -1,14 +0,0 @@
<Page
x:Class="FoxTube.Views.PlaylistView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
</Grid>
</Page>
-30
View File
@@ -1,30 +0,0 @@
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;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class PlaylistView : Page
{
public PlaylistView()
{
this.InitializeComponent();
}
}
}
-100
View File
@@ -1,100 +0,0 @@
<Page
xmlns:models="using:FoxTube.Core.Models"
x:Class="FoxTube.Views.SearchView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:FoxTube.Controls"
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Margin="10,0">
<StackPanel.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True"/>
<AddDeleteThemeTransition/>
</TransitionCollection>
</StackPanel.ChildrenTransitions>
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="Found [num] item(s)"/>
<HyperlinkButton Click="ToggleFilters_Click" Content="Show filters &#xE71C;" FontFamily="Default, Segoe MDL2 Assets"/>
<StackPanel Name="filters" Visibility="Collapsed">
<GridView Padding="5" SelectionMode="None">
<GridView.Resources>
<Style TargetType="ComboBox">
<Setter Property="Width" Value="150"/>
<Setter Property="SelectedIndex" Value="0"/>
</Style>
</GridView.Resources>
<ComboBox Name="order" Header="Sort by">
<ComboBoxItem Content="Relevance"/>
<ComboBoxItem Content="Upload date"/>
<ComboBoxItem Content="View count"/>
<ComboBoxItem Content="Rating"/>
<ComboBoxItem Content="Title"/>
</ComboBox>
<ComboBox Name="type" Header="Type">
<ComboBoxItem Content="All"/>
<ComboBoxItem Content="Video"/>
<ComboBoxItem Content="Channel"/>
<ComboBoxItem Content="Playlist"/>
</ComboBox>
<ComboBox Name="date" Header="Upload date">
<ComboBoxItem Content="Anytime"/>
<ComboBoxItem Content="Last hour"/>
<ComboBoxItem Content="Today"/>
<ComboBoxItem Content="This week"/>
<ComboBoxItem Content="This month"/>
<ComboBoxItem Content="This year"/>
</ComboBox>
<ComboBox Visibility="Visible" Name="duration" Header="Duration">
<ComboBoxItem Content="Any"/>
<ComboBoxItem Content="Long (&#x3E; 20 minutes)"/>
<ComboBoxItem Content="Medium"/>
<ComboBoxItem Content="Short (&#x3C; 4 minutes)"/>
</ComboBox>
</GridView>
<Grid ColumnSpacing="10" Margin="5,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Button Visibility="Visible" Content="Features" Name="features">
<Button.Flyout>
<MenuFlyout Closing="MenuFlyout_Closing">
<ToggleMenuFlyoutItem Text="HD" Click="ToggleMenuFlyoutItem_Click"/>
<ToggleMenuFlyoutItem Text="3D" Click="ToggleMenuFlyoutItem_Click"/>
<ToggleMenuFlyoutItem Text="Subtitles/CC" Click="ToggleMenuFlyoutItem_Click"/>
<ToggleMenuFlyoutItem Text="Live" Click="ToggleMenuFlyoutItem_Click"/>
<ToggleMenuFlyoutItem Text="Creative Commons License" Click="ToggleMenuFlyoutItem_Click"/>
</MenuFlyout>
</Button.Flyout>
</Button>
<Button Grid.Column="1" Content="Apply"/>
</Grid>
</StackPanel>
</StackPanel>
<RefreshContainer Grid.Row="1">
<ScrollViewer Padding="5,0">
<controls:ItemsGrid Grid.Row="1" x:Name="collection"/>
</ScrollViewer>
</RefreshContainer>
<toolkit:Loading Grid.RowSpan="2" IsLoading="False" x:Name="recommendedLoading" VerticalContentAlignment="Center">
<toolkit:Loading.Background>
<AcrylicBrush BackgroundSource="HostBackdrop" TintColor="{ThemeResource SystemColorBackgroundColor}" TintOpacity=".5"/>
</toolkit:Loading.Background>
<ProgressRing Height="100" Width="100" IsActive="True"/>
</toolkit:Loading>
</Grid>
</Page>
-45
View File
@@ -1,45 +0,0 @@
using FoxTube.Attributes;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
namespace FoxTube.Views
{
/// <summary>
/// Search results page
/// </summary>
[Refreshable]
public sealed partial class SearchView : Page
{
bool closingByToggle = false;
public SearchView() =>
InitializeComponent();
void ToggleFilters_Click(object sender, RoutedEventArgs e)
{
if (filters.Visibility == Visibility.Visible)
{
filters.Visibility = Visibility.Collapsed;
(sender as HyperlinkButton).Content = "Show filters \xE71C";
}
else
{
filters.Visibility = Visibility.Visible;
(sender as HyperlinkButton).Content = "Hide filters \xE71C";
}
}
private void MenuFlyout_Closing(FlyoutBase sender, FlyoutBaseClosingEventArgs args)
{
if (closingByToggle)
{
args.Cancel = true;
closingByToggle = false;
}
}
void ToggleMenuFlyoutItem_Click(object sender, RoutedEventArgs e) =>
closingByToggle = true;
}
}
@@ -1,71 +0,0 @@
<Page
xmlns:system="using:System"
xmlns:pages="using:FoxTube.Pages"
x:Class="FoxTube.Views.SettingsSections.AboutSection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<ScrollViewer Padding="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="1" VerticalAlignment="Top" Source="/Assets/StoreLogo.scale-400.png" Width="150"/>
<StackPanel>
<StackPanel.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True" FromVerticalOffset="100"/>
</TransitionCollection>
</StackPanel.ChildrenTransitions>
<TextBlock Text="FoxTube" Style="{StaticResource SubheaderTextBlockStyle}"/>
<TextBlock x:Name="VersionLabel" Text="[currentVersion]" Style="{StaticResource CaptionTextBlockStyle}" FontStyle="Italic" Margin="0,-5,0,0"/>
<TextBlock TextWrapping="WrapWholeWords" Text="Developed by Michael &#x22;XFox&#x22; Gordeev" Margin="0,10,0,0"/>
<StackPanel Margin="0,10,0,0">
<TextBlock Text="Special thanks to:" Style="{StaticResource TitleTextBlockStyle}"/>
<TextBlock>
<Hyperlink NavigateUri="https://github.com/Tyrrrz">@Tyrrrz</Hyperlink> for his awesome library
<LineBreak/><Hyperlink NavigateUri="https://vk.com/msreviewnet">@msreviewnet</Hyperlink> for warm welcome and first feedback
<LineBreak/><Underline Foreground="Red">You</Underline> for using my app :)
</TextBlock>
</StackPanel>
<StackPanel Margin="0,10,0,0">
<TextBlock Text="Contacts" Style="{StaticResource TitleTextBlockStyle}"/>
<TextBlock>
Twitter: <Hyperlink NavigateUri="https://twitter.com/xfox111">@xfox111</Hyperlink>
<LineBreak/>Vkontakte: <Hyperlink NavigateUri="https://vk.com/XFox.Mike">@XFox.Mike</Hyperlink>
<!--<LineBreak/>YouTube: <Hyperlink NavigateUri="https://youtube.com/c/FoxGameStudioChannel">@xfox</Hyperlink>-->
<LineBreak/>E-mail: <Hyperlink NavigateUri="mailto:michael@xfox111.net">michael@xfox111.net</Hyperlink>
<LineBreak/>My website: <Hyperlink NavigateUri="https://xfox111.net">https://xfox111.net</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Margin="0,10,0,0">
<TextBlock Text="Legal stuff" Style="{StaticResource TitleTextBlockStyle}"/>
<TextBlock>
<Hyperlink NavigateUri="https://xfox111.net/Projects/FoxTube/Privacy">Our Privacy Policy</Hyperlink>
<LineBreak/><Hyperlink NavigateUri="https://youtube.com/t/privacy">YouTube Privacy Policy</Hyperlink>
<LineBreak/><Hyperlink NavigateUri="https://youtube.com/t/terms">YouTube Terms of use</Hyperlink>
<LineBreak/><Hyperlink NavigateUri="https://youtube.com/t/community_guidelines">YouTube Community Guidelines</Hyperlink>
</TextBlock>
</StackPanel>
<TextBlock Name="CopyrightsLabel" Margin="0,10,0,0">
©[year] Michael Gordeev
<LineBreak/>©[year] YouTube, LLC
</TextBlock>
<Button Name="FeedbackButton" Content="Leave feedback" Margin="0,10" Click="OpenFeedbackHub"/>
</StackPanel>
</Grid>
</ScrollViewer>
</Page>
@@ -1,27 +0,0 @@
using FoxTube.Utils;
using System;
using Windows.UI.Xaml;
using FoxTube.Pages;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Views.SettingsSections
{
/// <summary>
/// About page
/// </summary>
public sealed partial class AboutSection : Page
{
public AboutSection()
{
InitializeComponent();
VersionLabel.Text = Metrics.CurrentVersion;
CopyrightsLabel.Text = CopyrightsLabel.Text.Replace("[year]", DateTime.Today.Year.ToString());
FeedbackButton.Visibility = FeedbackInterop.HasFeedbackHub ? Visibility.Visible : Visibility.Collapsed;
}
private void OpenFeedbackHub(object sender, RoutedEventArgs e) =>
FeedbackInterop.OpenFeedbackHub();
}
}
@@ -1,100 +0,0 @@
<Page
x:Class="FoxTube.Views.SettingsSections.InboxSection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:data="using:Google.Apis.Blogger.v3.Data"
mc:Ignorable="d"
Loaded="Page_Loaded">
<Page.Resources>
<Style TargetType="controls:DropShadowPanel">
<Setter Property="OffsetX" Value="3"/>
<Setter Property="OffsetY" Value="3"/>
<Setter Property="ShadowOpacity" Value=".5"/>
</Style>
</Page.Resources>
<controls:MasterDetailsView MasterPaneWidth="400" CompactModeThresholdWidth="850" x:Name="masterDetailsView" BackButtonBehavior="Inline">
<controls:MasterDetailsView.ItemContainerTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True" FromVerticalOffset="100"/>
</TransitionCollection>
</controls:MasterDetailsView.ItemContainerTransitions>
<controls:MasterDetailsView.MasterHeader>
<StackPanel Margin="0,0,0,10">
<ProgressBar IsIndeterminate="True" x:Name="progressBar" Background="Transparent"/>
<ComboBox Header="Filter" HorizontalAlignment="Stretch" x:Name="filter" SelectionChanged="FilterChanged" IsEnabled="False">
<ComboBoxItem Content="All"/>
<ComboBoxItem Content="Changelogs"/>
<ComboBoxItem Content="Messages"/>
</ComboBox>
</StackPanel>
</controls:MasterDetailsView.MasterHeader>
<controls:MasterDetailsView.NoSelectionContent>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<controls:DropShadowPanel Margin="20,0">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE0A6;" Style="{ThemeResource HeaderTextBlockStyle}"/>
</controls:DropShadowPanel>
<controls:DropShadowPanel>
<TextBlock Text="Select an item to view" Style="{StaticResource SubheaderTextBlockStyle}"/>
</controls:DropShadowPanel>
</StackPanel>
</controls:MasterDetailsView.NoSelectionContent>
<controls:MasterDetailsView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Padding" Value="0"/>
</Style>
</controls:MasterDetailsView.ItemContainerStyle>
<controls:MasterDetailsView.ItemTemplate>
<DataTemplate x:DataType="data:Post">
<Grid ColumnSpacing="10" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<PersonPicture Width="50" VerticalAlignment="Top" ProfilePicture="{Binding Avatar}" Initials="{Binding DefaultIcon}" FontFamily="Segoe MDL2 Assets" Foreground="White"/>
<StackPanel Grid.Column="1">
<TextBlock Text="{Binding Title}" Style="{StaticResource SubtitleTextBlockStyle}" MaxLines="1"/>
<TextBlock Text="{Binding Description}" MaxLines="2"/>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" FontStyle="Italic" MaxLines="1">
<Run Text="{Binding Type}"/> • <Run Text="{Binding ShortTimeStamp}"/>
</TextBlock>
</StackPanel>
</Grid>
</DataTemplate>
</controls:MasterDetailsView.ItemTemplate>
<controls:MasterDetailsView.DetailsTemplate>
<DataTemplate x:DataType="data:Post">
<ScrollViewer>
<Grid RowSpacing="10" Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<RelativePanel Margin="0,10">
<PersonPicture x:Name="avatar" Foreground="White" FontFamily="Segoe MDL2 Assets" Initials="{Binding DefaultIcon}" ProfilePicture="{Binding Avatar}" Height="60"/>
<StackPanel RelativePanel.RightOf="avatar" Margin="10,0">
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="{Binding Title}"/>
<TextBlock Text="{Binding TimeStamp}"/>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" FontStyle="Italic" Text="{Binding Type}"/>
</StackPanel>
</RelativePanel>
<controls:MarkdownTextBlock Background="Transparent" Grid.Row="1" Text="{Binding Content}"/>
</Grid>
</ScrollViewer>
</DataTemplate>
</controls:MasterDetailsView.DetailsTemplate>
</controls:MasterDetailsView>
</Page>
@@ -1,52 +0,0 @@
using System;
using System.Linq;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Views.SettingsSections
{
/// <summary>
/// Inbox view
/// </summary>
public sealed partial class InboxSection : Page
{
Google.Apis.Blogger.v3.Data.Post[] items;
string idToOpen;
public InboxSection() =>
InitializeComponent();
private void Page_Loaded(object sender, RoutedEventArgs e)
{
items = Services.InboxService.GetInboxCollection().ToArray();
filter.SelectedIndex = 0;
progressBar.IsIndeterminate = false;
filter.IsEnabled = true;
if (idToOpen != null)
Open(idToOpen);
}
private void FilterChanged(object sender, SelectionChangedEventArgs e) =>
masterDetailsView.ItemsSource = filter.SelectedIndex switch
{
1 => items.Where(i => i.Id.StartsWith("changelog")),
2 => items.Where(i => i.Id.StartsWith("inbox")),
_ => items
};
public void Open(string id)
{
idToOpen = id;
if (!IsLoaded)
return;
masterDetailsView.SelectedItem = (masterDetailsView.ItemsSource as List<Google.Apis.Blogger.v3.Data.Post>).Find(i => i.Id == id);
idToOpen = null;
}
}
}
@@ -1,61 +0,0 @@
<Page
x:Class="FoxTube.Views.SettingsSections.PreferencesSection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winui="using:Microsoft.UI.Xaml.Controls" xmlns:globalization="using:System.Globalization"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
<Style TargetType="ComboBox">
<Setter Property="MinWidth" Value="250"/>
</Style>
</Page.Resources>
<ScrollViewer Padding="10">
<StackPanel>
<StackPanel.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True" FromVerticalOffset="100"/>
</TransitionCollection>
</StackPanel.ChildrenTransitions>
<StackPanel Margin="0,0,0,10">
<TextBlock Text="General" Style="{StaticResource TitleTextBlockStyle}"/>
<CheckBox x:Name="MetricsCheckbox" Content="Allow to send anonymous statistics and data to help us improve the app" IsEnabled="False" Checked="MetricsCheckbox_Checked" Unchecked="MetricsCheckbox_Checked" ToolTipService.ToolTip="You cannot change the value since you are using preview version"/>
</StackPanel>
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Region &#x0026; Search" Style="{StaticResource TitleTextBlockStyle}"/>
<ComboBox x:Name="RelevanceLanguageList" Header="Prefered content language" SelectionChanged="RelevanceLanguageList_SelectionChanged" DisplayMemberPath="DisplayName"/>
</StackPanel>
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Downloads" Style="{StaticResource TitleTextBlockStyle}"/>
<Grid Width="250" HorizontalAlignment="Left" ColumnSpacing="5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="DownloadsPathTextBox" Header="Default downloads folder" IsReadOnly="True"/>
<Button x:Name="ChangeDownloadsPathButton" Grid.Column="1" VerticalAlignment="Bottom" FontFamily="Segoe MDL2 Assets" Content="&#xE10C;" Padding="0" Height="32" Width="32" Click="ChangeDownloadsPathButton_Click"/>
</Grid>
<CheckBox x:Name="AskDownloadsCheckbox" Content="Always ask where to save a video" Checked="AskDownloadsCheckbox_Checked" Unchecked="AskDownloadsCheckbox_Checked"/>
</StackPanel>
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Appearance" Style="{StaticResource TitleTextBlockStyle}"/>
<winui:RadioButtons Header="Color mode" x:Name="ThemeRadio" SelectionChanged="ThemeRadio_SelectionChanged">
<RadioButton Content="Windows default"/>
<RadioButton Content="Light"/>
<RadioButton Content="Dark"/>
</winui:RadioButtons>
<HyperlinkButton Content="Windows color settings" NavigateUri="ms-settings:colors"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Page>
@@ -1,93 +0,0 @@
using System;
using System.Globalization;
using FoxTube.Services;
using Microsoft.UI.Xaml.Controls;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using System.Linq;
namespace FoxTube.Views.SettingsSections
{
/// <summary>
/// Preferences page
/// </summary>
public sealed partial class PreferencesSection : Page
{
public PreferencesSection()
{
InitializeComponent();
MetricsCheckbox.IsChecked = SettingsService.AllowAnalytics;
RelevanceLanguageList.ItemsSource = CultureInfo.GetCultures(CultureTypes.NeutralCultures);
RelevanceLanguageList.SelectedIndex = CultureInfo.GetCultures(CultureTypes.NeutralCultures).ToList().FindIndex(i => i.TwoLetterISOLanguageName == SettingsService.RelevanceLanguage);
AskDownloadsCheckbox.IsChecked = SettingsService.AskEveryDownload;
SetDownloadsPath();
ThemeRadio.SelectedIndex = (int)SettingsService.Theme;
}
private async void SetDownloadsPath() =>
DownloadsPathTextBox.Text = (await DownloadsService.GetDefaultDownloadsFolder()).Path;
private void ThemeRadio_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Frame frame = Window.Current.Content as Frame;
RadioButtons set = sender as RadioButtons;
if ((int)SettingsService.Theme == set.SelectedIndex)
return;
(Window.Current.Content as Frame).RequestedTheme = SettingsService.Theme = (ElementTheme)set.SelectedIndex;
if (SettingsService.Theme == ElementTheme.Default)
Utils.Utils.UpdateTitleBarTheme(Application.Current.RequestedTheme == ApplicationTheme.Dark);
else
Utils.Utils.UpdateTitleBarTheme(frame.RequestedTheme == ElementTheme.Dark);
}
private async void MetricsCheckbox_Checked(object sender, RoutedEventArgs e)
{
if (MetricsCheckbox.IsChecked == SettingsService.AllowAnalytics)
return;
if (!MetricsCheckbox.IsChecked.Value)
{
ContentDialog dialog = new ContentDialog
{
Title = "Are you sure?",
Content = "This information is very important for us. It helps us to fix problems faster and implement new awesome features quickly. Be sure that none of your personal information will be involved\n" +
"Check out our privacy policy for details\n" +
"Are you sure you want to continue?",
PrimaryButtonText = "No",
CloseButtonText = "Yes",
SecondaryButtonText = "Open privacy policy"
};
if (await dialog.ShowAsync() != ContentDialogResult.None)
return;
}
SettingsService.AllowAnalytics = MetricsCheckbox.IsChecked.Value;
}
private void RelevanceLanguageList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (SettingsService.RelevanceLanguage != ((CultureInfo)RelevanceLanguageList.SelectedItem).TwoLetterISOLanguageName)
SettingsService.RelevanceLanguage = ((CultureInfo)RelevanceLanguageList.SelectedItem).TwoLetterISOLanguageName;
}
private async void ChangeDownloadsPathButton_Click(object sender, RoutedEventArgs e)
{
StorageFolder newFolder = await DownloadsService.ChangeDefaultFolder();
if (newFolder != null)
DownloadsPathTextBox.Text = newFolder.Path;
}
private void AskDownloadsCheckbox_Checked(object sender, RoutedEventArgs e)
{
if (SettingsService.AskEveryDownload != ((CheckBox)sender).IsChecked.Value)
SettingsService.AskEveryDownload = ((CheckBox)sender).IsChecked.Value;
}
}
}
-21
View File
@@ -1,21 +0,0 @@
<Page
x:Class="FoxTube.Views.SettingsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:settingssections="using:FoxTube.Views.SettingsSections"
mc:Ignorable="d">
<Pivot SelectedIndex="0" Name="PivotControl">
<PivotItem Name="PreferencesTab" Header="Preferences">
<settingssections:PreferencesSection/>
</PivotItem>
<PivotItem Name="AboutTab" Header="About us">
<settingssections:AboutSection/>
</PivotItem>
<PivotItem Name="InboxTab" Header="Inbox">
<settingssections:InboxSection x:Name="InboxSection"/>
</PivotItem>
</Pivot>
</Page>
-42
View File
@@ -1,42 +0,0 @@
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace FoxTube.Views
{
/// <summary>
/// Settings page
/// </summary>
public sealed partial class SettingsView : Page
{
public SettingsView() =>
InitializeComponent();
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (string.IsNullOrWhiteSpace(e.Parameter as string))
return;
string[] param = (e.Parameter as string).Split('/');
switch (param[0])
{
case "about":
case "info":
PivotControl.SelectedItem = AboutTab;
break;
case "inbox":
case "message":
case "changelog":
PivotControl.SelectedItem = InboxTab;
if (param.Length > 1)
InboxSection.Open(param[1]);
break;
default:
PivotControl.SelectedItem = PreferencesTab;
break;
}
}
}
}
-81
View File
@@ -1,81 +0,0 @@
<Page
NavigationCacheMode="Enabled"
x:Class="FoxTube.Views.SubscriptionsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:data="using:FoxTube.Models"
xmlns:converters="using:FoxTube.Converters" xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<Page.Resources>
<converters:SubscriptionDataConverter x:Name="converter"/>
</Page.Resources>
<Grid>
<RefreshContainer RefreshRequested="RefreshContainer_RefreshRequested">
<ListView Padding="10" SelectionMode="None" IsItemClickEnabled="True" Name="list" ItemClick="List_ItemClick">
<ListView.ItemContainerTransitions>
<TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True"/>
<AddDeleteThemeTransition/>
</TransitionCollection>
</ListView.ItemContainerTransitions>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Padding" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Margin" Value="0,0,0,10"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="data:Subscription">
<Grid Height="140" Padding="20" ColumnSpacing="20" CornerRadius="20" RequestedTheme="Dark">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.Background>
<ImageBrush ImageSource="{Binding Path=Banner.BannerImageUrl}" Stretch="UniformToFill"/>
</Grid.Background>
<Grid Grid.ColumnSpan="3" Margin="-20">
<Grid.Background>
<AcrylicBrush TintColor="Black" TintOpacity=".5"/>
</Grid.Background>
</Grid>
<PersonPicture ProfilePicture="{Binding Path=Avatar.Medium.Url}"/>
<StackPanel Grid.Column="1">
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="{Binding Path=Title}" MaxLines="1" TextTrimming="CharacterEllipsis"/>
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="{Binding Converter={StaticResource converter}}" MaxLines="1" TextTrimming="WordEllipsis"/>
<TextBlock Text="{Binding Path=Description}" MaxLines="2"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="2">
<StackPanel.Resources>
<Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="Height" Value="50"/>
<Setter Property="MinWidth" Value="50"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
</StackPanel.Resources>
<Button Content="Subscribed" Width="200" Click="Unsubscribe" Tag="{Binding Path=ChannelId}"/>
<Button Content="&#xEA8F;" FontFamily="Segoe MDL2 Assets" Visibility="Collapsed"/>
</StackPanel>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</RefreshContainer>
<controls:Loading IsLoading="False" x:Name="loadingScreen" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<ProgressRing Width="50" Height="50" IsActive="True"/>
</controls:Loading>
</Grid>
</Page>
-58
View File
@@ -1,58 +0,0 @@
using FoxTube.Attributes;
using FoxTube.Models;
using FoxTube.Services;
using System.Linq;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace FoxTube.Views
{
/// <summary>
/// User's subscriptions list
/// </summary>
[Refreshable]
public sealed partial class SubscriptionsView : Page
{
public SubscriptionsView()
{
InitializeComponent();
list.ItemsSource = UserService.CurrentUser.Subscriptions;
}
private void List_ItemClick(object sender, ItemClickEventArgs e)
{
// TODO: Navigate to channel
}
private async void Unsubscribe(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
loadingScreen.IsLoading = true;
await UserService.CurrentUser.UpdateSubscriptionState((sender as Button).Tag as string);
list.ItemsSource = UserService.CurrentUser.Subscriptions;
loadingScreen.IsLoading = false;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.Refresh)
RefreshSubscriptions();
}
private void RefreshContainer_RefreshRequested(RefreshContainer sender, RefreshRequestedEventArgs args) =>
RefreshSubscriptions();
private async void RefreshSubscriptions()
{
loadingScreen.IsLoading = true;
await UserService.CurrentUser.LoadSubscriptions();
list.ItemsSource = UserService.CurrentUser.Subscriptions;
MainPage.Current.UpdateMenu();
loadingScreen.IsLoading = false;
}
}
}
Binary file not shown.