Archived
1
0

Settings rebuild

This commit is contained in:
Michael Gordeev
2018-08-01 19:04:12 +03:00
parent 00981c67c0
commit ba02a37760
18 changed files with 276 additions and 328 deletions
+24 -26
View File
@@ -43,44 +43,42 @@ namespace FoxTube.Controls
client.DownloadFileCompleted += DownloadCompleted;
client.DownloadProgressChanged += UpdateInfo;
}
async void Download(string id, YouTubeQuality q)
{
try
{
Download(id, q);
Id = id;
VideosResource.ListRequest request = SecretsVault.NoAuthService.Videos.List("snippet");
request.Id = id;
var response = (await request.ExecuteAsync()).Items[0];
Uri url = (await YouTube.GetVideoUriAsync(id, q)).Uri;
client.DownloadFileAsync(url, settings.Values["defaultDownload"] as string + $@"\{response.Snippet.Title} - {response.Snippet.ChannelTitle}.mp4");
thumbnail.Source = new BitmapImage(new Uri(response.Snippet.Thumbnails.Standard.Url));
title.Text = response.Snippet.Title;
channel.Text = $"Author: {response.Snippet.ChannelTitle}";
quality.Text = $"Quality: {Methods.QualityToString(q)}"; TimeSpan ts = XmlConvert.ToTimeSpan(response.ContentDetails.Duration);
duration.Text = string.Format("Duration: {0}{1:00}:{2:00} | ", ts.Hours == 0 ? "" : ts.Hours + ":", ts.Minutes, ts.Seconds);
uri = settings.Values["defaultDownload"] as string + $@"\{response.Snippet.Title} - {response.Snippet.ChannelTitle}.mp4";
status.Text = "Downloading...";
perc.Text = "0%";
}
catch
{
if (client.IsBusy)
client.CancelAsync();
new MessageDialog("We were unable to download video due to connection problems or internal YouTube server error. Please, try again later.", "Failed to download").ShowAsync();
await new MessageDialog("We were unable to download video due to connection problems or internal YouTube server error. Please, try again later.", "Failed to download").ShowAsync();
throw new FileNotFoundException();
}
}
async void Download(string id, YouTubeQuality q)
{
Id = id;
VideosResource.ListRequest request = SecretsVault.NoAuthService.Videos.List("snippet");
request.Id = id;
var response = (await request.ExecuteAsync()).Items[0];
Uri url = (await YouTube.GetVideoUriAsync(id, q)).Uri;
client.DownloadFileAsync(url, settings.Values["defaultDownload"] as string + $@"\{response.Snippet.Title} - {response.Snippet.ChannelTitle}.mp4");
thumbnail.Source = new BitmapImage(new Uri(response.Snippet.Thumbnails.Standard.Url));
title.Text = response.Snippet.Title;
channel.Text = $"Author: {response.Snippet.ChannelTitle}";
quality.Text = $"Quality: {Methods.QualityToString(q)}"; TimeSpan ts = XmlConvert.ToTimeSpan(response.ContentDetails.Duration);
duration.Text = string.Format("Duration: {0}{1:00}:{2:00} | ", ts.Hours == 0 ? "" : ts.Hours + ":", ts.Minutes, ts.Seconds);
uri = settings.Values["defaultDownload"] as string + $@"\{response.Snippet.Title} - {response.Snippet.ChannelTitle}.mp4";
status.Text = "Downloading...";
perc.Text = "0%";
}
private void UpdateInfo(object sender, DownloadProgressChangedEventArgs e)
{
progressBar.Value = e.ProgressPercentage;
+18 -10
View File
@@ -130,11 +130,11 @@
<Compile Include="Pages\Downloads.xaml.cs">
<DependentUpon>Downloads.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Feedback.xaml.cs">
<DependentUpon>Feedback.xaml</DependentUpon>
<Compile Include="Pages\SettingsPages\About.xaml.cs">
<DependentUpon>About.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\General.xaml.cs">
<DependentUpon>General.xaml</DependentUpon>
<Compile Include="Pages\SettingsPages\Feedback.xaml.cs">
<DependentUpon>Feedback.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\History.xaml.cs">
<DependentUpon>History.xaml</DependentUpon>
@@ -142,7 +142,7 @@
<Compile Include="Pages\Home.xaml.cs">
<DependentUpon>Home.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Inbox.xaml.cs">
<Compile Include="Pages\SettingsPages\Inbox.xaml.cs">
<DependentUpon>Inbox.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\LoadingPage.xaml.cs">
@@ -171,7 +171,7 @@
<Compile Include="SubLayer.xaml.cs">
<DependentUpon>SubLayer.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Translate.xaml.cs">
<Compile Include="Pages\SettingsPages\Translate.xaml.cs">
<DependentUpon>Translate.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Video.xaml.cs">
@@ -318,11 +318,11 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Feedback.xaml">
<Page Include="Pages\SettingsPages\About.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\General.xaml">
<Page Include="Pages\SettingsPages\Feedback.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -334,7 +334,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Inbox.xaml">
<Page Include="Pages\SettingsPages\Inbox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -370,7 +370,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Translate.xaml">
<Page Include="Pages\SettingsPages\Translate.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -414,6 +414,9 @@
<PackageReference Include="Google.Apis.YouTube.v3">
<Version>1.29.2.1006</Version>
</PackageReference>
<PackageReference Include="Microsoft.Advertising.XAML">
<Version>10.1805.7001</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.1.5</Version>
</PackageReference>
@@ -442,6 +445,11 @@
<Name>FoxTube.Background</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.Advertising.Xaml, Version=10.0">
<Name>Microsoft Advertising SDK for XAML</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
-41
View File
@@ -1,41 +0,0 @@
<Page
x:Class="FoxTube.General"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Text="General settings" FontSize="28"/>
<ComboBox Margin="0,0,0,10" Width="250" Header="Default video playback quality" Name="quality" SelectionChanged="quality_SelectionChanged">
<ComboBoxItem Content="Auto"/>
<ComboBoxItem Content="1080p60"/>
<ComboBoxItem Content="1080p30"/>
<ComboBoxItem Content="720p60"/>
<ComboBoxItem Content="720p30"/>
<ComboBoxItem Content="480p"/>
<ComboBoxItem Content="360p"/>
<ComboBoxItem Content="240p"/>
<ComboBoxItem Content="144p"/>
</ComboBox>
<ToggleSwitch OnContent="Notifications" OffContent="Notifications" Name="notifications" Toggled="notification_IsEnabledChanged"/>
<StackPanel Margin="25,0,0,0">
<CheckBox IsEnabled="False" Content="Subscriptions' uploads" Name="newVideo" Click="notification_IsEnabledChanged"/>
<CheckBox IsEnabled="False" Content="Developer's messages" Name="messages" Margin="0,0,0,10" Click="notification_IsEnabledChanged"/>
</StackPanel>
<ToggleSwitch OnContent="Notify when playing on mobile data" OffContent="Notify when playing on mobile data" Name="mobileWarning" Toggled="notification_IsEnabledChanged"/>
<ToggleSwitch OnContent="Play videos automatically" OffContent="Play videos automatically" Name="autoplay" Margin="0,0,0,10" Toggled="notification_IsEnabledChanged"/>
<ComboBox Header="Language" MinWidth="250" Name="language" SelectionChanged="language_SelectionChanged">
<ComboBoxItem Content="English"/>
<ComboBoxItem Content="Russian"/>
</ComboBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" BorderBrush="OrangeRed" BorderThickness="3" Margin="0,10,0,0" Padding="2" Visibility="Collapsed" Name="restartNote">
<TextBlock FontFamily="Segoe MDL2 Assets" FontWeight="Bold" Text="&#xE7BA;" FontSize="30" Foreground="OrangeRed"/>
<TextBlock FontFamily="Default" FontWeight="Bold" Text="Reopen the app to apply settings" Foreground="OrangeRed" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel>
</Grid>
</Page>
-79
View File
@@ -1,79 +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.Storage;
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
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class General : Page
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public General()
{
this.InitializeComponent();
language.SelectedIndex = (int)settings.Values["language"];
quality.SelectedIndex = (int)settings.Values["quality"];
notifications.IsOn = (bool)settings.Values["notifications"];
newVideo.IsChecked = (bool)settings.Values["newVideoNotification"];
messages.IsChecked = (bool)settings.Values["newmessagesNotification"];
mobileWarning.IsOn = (bool)settings.Values["moblieWarning"];
autoplay.IsOn = (bool)settings.Values["videoAutoplay"];
}
private void language_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if((int)settings.Values["language"] != language.SelectedIndex)
{
settings.Values["language"] = language.SelectedIndex;
restartNote.Visibility = Visibility.Visible;
}
}
private void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if ((int)settings.Values["quality"] != quality.SelectedIndex)
settings.Values["quality"] = quality.SelectedIndex;
}
private void notification_IsEnabledChanged(object sender, RoutedEventArgs e)
{
if (notifications.IsOn)
{
settings.Values["notificaitons"] = true;
newVideo.IsEnabled = false;
messages.IsEnabled = false;
}
if ((bool)settings.Values["newVideoNotification"] != newVideo.IsChecked)
settings.Values["newVideoNotification"] = newVideo.IsChecked;
if ((bool)settings.Values["newmessagesNotification"] != messages.IsChecked)
settings.Values["newmessagesNotification"] = messages.IsChecked;
if ((bool)settings.Values["moblieWarning"] != mobileWarning.IsOn)
settings.Values["moblieWarning"] = mobileWarning.IsOn;
if ((bool)settings.Values["videoAutoplay"] != autoplay.IsOn)
settings.Values["videoAutoplay"] = autoplay.IsOn;
}
}
}
+23 -2
View File
@@ -5,10 +5,25 @@
xmlns:local="using:FoxTube"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ads="using:Microsoft.Advertising.WinRT.UI"
mc:Ignorable="d"
SizeChanged="Page_SizeChanged">
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="600"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="openSearch.Visibility" Value="Collapsed"/>
<Setter Target="compactSearch.Visibility" Value="Visible"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
@@ -24,7 +39,7 @@
<TextBlock Text="FoxTube" FontSize="20" FontWeight="Bold" Margin="5, 0, 0, 0" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Name="headerText"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Background="Red">
<Grid Width="50">
<Button Name="notificationMenu" ToolTipService.ToolTip="Notifications" Click="notificationMenu_Click"
FontFamily="Segoe MDL2 Assets" Content="&#xED0D;" Foreground="White"
@@ -97,7 +112,7 @@
</Popup>
</Grid>-->
<Grid>
<Grid Name="compactSearch" Visibility="Collapsed">
<TextBox KeyUp="searchField_KeyUp" Name="searchField" ToolTipService.ToolTip="Search" Margin="4" Width="350" Height="42" Padding="10,10,45,0" PlaceholderText="Search" BorderThickness="0" Background="#7FFFFFFF" Text="DAGmaes" TextChanged="searchField_TextChanged" GotFocus="searchField_GotFocus"/>
<Button Name="searchButton" HorizontalAlignment="Right" Click="searchButton_Click"
Width="42" Height="42" Margin="4"
@@ -106,8 +121,14 @@
<Popup Margin="0,50,0,0" Name="searchSuggestions" IsOpen="False" Width="350" IsLightDismissEnabled="True"/>
</Grid>
<Button Width="50" Height="50" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="&#xE11A;" Foreground="White" Name="openSearch" Visibility="Visible"/>
</StackPanel>
<Grid Visibility="Collapsed">
<TextBox HorizontalAlignment="Stretch" Background="White" BorderThickness="1" BorderBrush="Gray" PlaceholderText="Search" Padding="10,13,10,0" Margin="0,0,50,0"/>
<Button Background="White" HorizontalAlignment="Right" Width="50" Height="50" FontFamily="Segoe MDL2 Assets" Content="&#xE11A;"/>
</Grid>
</Grid>
<SplitView Name="menu" Grid.Row="1" OpenPaneLength="250" CompactPaneLength="50" DisplayMode="CompactInline" IsPaneOpen="True" PaneClosing="menu_PaneClosed" PaneOpening="menu_PaneOpened">
<SplitView.Pane>
<Grid>
+27 -53
View File
@@ -71,8 +71,6 @@ namespace FoxTube
if (settings.Values["newVideoNotification"] == null)
settings.Values.Add("newVideoNotification", true);
if (settings.Values["notifications"] == null)
settings.Values.Add("notifications", true);
if (settings.Values["newmessagesNotification"] == null)
settings.Values.Add("newmessagesNotification", true);
@@ -219,52 +217,15 @@ namespace FoxTube
notificationMenu.Content = "";
}
private void HamburgerSelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
if (sender == mainList)
{
subscriptionsList.SelectedItem = null;
categoriesList.SelectedItem = null;
serviceList.SelectedItem = null;
MainListSelected();
}
else if (sender == subscriptionsList)
{
mainList.SelectedItem = null;
categoriesList.SelectedItem = null;
serviceList.SelectedItem = null;
SubscriptionSelected();
}
else if (sender == categoriesList)
{
subscriptionsList.SelectedItem = null;
mainList.SelectedItem = null;
serviceList.SelectedItem = null;
FeaturedSelected();
}
else if (sender == serviceList)
{
subscriptionsList.SelectedItem = null;
mainList.SelectedItem = null;
categoriesList.SelectedItem = null;
ServiceListSelected();
}
else
{
mainList.SelectedItem = null;
subscriptionsList.SelectedItem = null;
categoriesList.SelectedItem = null;
serviceList.SelectedItem = null;
}
} catch { }
}
void MainListSelected()
void MainListSelected(object sender, SelectionChangedEventArgs e)
{
if (mainList.SelectedItem == null)
return;
subscriptionsList.SelectedItem = null;
categoriesList.SelectedItem = null;
serviceList.SelectedItem = null;
object s = mainList.SelectedItem;
if (s == toHistory)
@@ -281,10 +242,15 @@ namespace FoxTube
content.Navigate(typeof(Home));
}
void ServiceListSelected()
void ServiceListSelected(object sender, SelectionChangedEventArgs e)
{
if (serviceList.SelectedItem == null)
return;
mainList.SelectedItem = null;
subscriptionsList.SelectedItem = null;
categoriesList.SelectedItem = null;
object s = serviceList.SelectedItem;
if (s == toChannel)
@@ -295,18 +261,28 @@ namespace FoxTube
content.Navigate(typeof(Settings));
}
void SubscriptionSelected()
void SubscriptionSelected(object sender, SelectionChangedEventArgs e)
{
if (subscriptionsList.SelectedItem == null)
return;
mainList.SelectedItem = null;
categoriesList.SelectedItem = null;
serviceList.SelectedItem = null;
content.Navigate(typeof(Channel), SecretsVault.Subscriptions[subscriptionsList.SelectedIndex - 1].Snippet.ChannelId);
}
void FeaturedSelected()
void FeaturedSelected(object sender, SelectionChangedEventArgs e)
{
if (serviceList.SelectedItem == null)
return;
switch(serviceList.SelectedIndex)
mainList.SelectedItem = null;
subscriptionsList.SelectedItem = null;
serviceList.SelectedItem = null;
switch (serviceList.SelectedIndex)
{
case 0:
content.Navigate(typeof(Channel), "UC-9-kyTW8ZkZNDHQJ6FgpwQ");
@@ -521,13 +497,11 @@ namespace FoxTube
public void GoToChannel(string id)
{
MinimizeVideo();
headerText.Text = "Channel overview";
content.Navigate(typeof(Channel), id);
}
public void GoToVideo(string id)
{
headerText.Text = "Video";
menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
menu.IsPaneOpen = false;
isForcedCollapsed = true;
@@ -544,13 +518,13 @@ namespace FoxTube
public void GoToDeveloper(string id)
{
MinimizeVideo();
content.Navigate(typeof(Settings), "inbox");
}
public void GoToPlaylist(string id)
{
MinimizeVideo();
headerText.Text = "Playlist overview";
content.Navigate(typeof(PlaylistPage), id);
}
+1
View File
@@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:foxtube="using:FoxTube"
xmlns:ui="using:Microsoft.Advertising.WinRT.UI"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+6 -74
View File
@@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="using:FoxTube.Pages"
xmlns:settingspages="using:FoxTube.Pages.SettingsPages"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
@@ -14,7 +15,7 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="1">
<Pivot SelectedIndex="0" Name="content" Grid.Row="1" IsHeaderItemsCarouselEnabled="False" SelectionChanged="content_SelectionChanged">
<Pivot SelectedIndex="0" Name="pivot" Grid.Row="1" IsHeaderItemsCarouselEnabled="False" SelectionChanged="content_SelectionChanged">
<PivotItem Margin="0,-48,0,0">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Text="Preferences" FontSize="28"/>
@@ -49,87 +50,21 @@
<TextBlock Text="Notifications" FontSize="22"/>
<CheckBox Content="New video" Name="newVideo" Click="notification_IsEnabledChanged"/>
<CheckBox Content="New post" Name="newPost" Click="notification_IsEnabledChanged"/>
<CheckBox Content="New commentary" Name="newComment" Click="notification_IsEnabledChanged"/>
<CheckBox Content="What's new posts" Visibility="Collapsed" Click="notification_IsEnabledChanged"/>
<CheckBox Content="Developer's messages" Name="messages" Margin="0,0,0,10" Click="notification_IsEnabledChanged"/>
<!--<TextBlock Text="Color scheme" FontSize="22"/>
<RadioButton Content="Light" GroupName="color" Name="darkTheme"/>
<RadioButton Content="Dark" GroupName="color" Name="lightTheme"/>
<RadioButton Content="Use system setting" GroupName="color" Name="systemTheme"/>
<TextBlock Text="Accent color" FontSize="22"/>
<RadioButton Content="Classic" GroupName="accentColor" Name="classicAccent"/>
<RadioButton Content="Custom" GroupName="accentColor" Name="customAccent"/>
<StackPanel Name="customColorPicker">
<ColorPicker HorizontalAlignment="Left" Margin="0,10,0,0" Name="colorPicker"/>
<Button Content="Apply" Margin="0,10,0,0" Name="applyColor"/>
</StackPanel>-->
</StackPanel>
</PivotItem>
<PivotItem Margin="0,-48,0,0">
</PivotItem>
<PivotItem Name="feedbackHub" Margin="0,-48,0,0">
<local:Feedback/>
<settingspages:Feedback/>
</PivotItem>
<PivotItem Margin="0,-48,0,0">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Text="About us and this app" FontSize="28"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="128"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Text="FoxTube" FontSize="24"/>
<TextBlock Name="version" Text="[currentVersion]" FontSize="14" Foreground="Gray" Margin="0,-5,0,10"/>
<TextBlock Text="Developed by Michael Gordeev (also known as XFox)" Margin="0,0,0,10"/>
<TextBlock Visibility="Collapsed" Text="Special thanks to contributors for motivating me, testers and translators for making this app better everyday and you for using this app;)" Margin="0,0,0,10"/>
<TextBlock Text="Contacts" FontSize="22" FontWeight="SemiBold"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Twitter:" Margin="0,0,5,0"/>
<HyperlinkButton Foreground="Red" Content="@XFox_Mike" Padding="0" NavigateUri="https://twitter.com/XFox_Mike"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Visibility="Collapsed">
<TextBlock Text="Facebook:" Margin="0,0,5,0"/>
<HyperlinkButton Foreground="Red" Content="@XFox.Mike" Padding="0"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="VKontakte:" Margin="0,0,5,0"/>
<HyperlinkButton Foreground="Red" Content="@XFox.Mike" Padding="0" NavigateUri="https://vk.com/XFox.Mike"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="YouTube:" Margin="0,0,5,0"/>
<HyperlinkButton Foreground="Red" Content="@FoxGameStudioChannel" Padding="0" NavigateUri="https://youtube.com/c/FoxGameStudioChannel"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="E-mail:" Margin="0,0,5,0"/>
<HyperlinkButton Foreground="Red" Content="foxgameofficial@gmail.com" Padding="0" NavigateUri="mailto:foxgameofficial+foxtube@gmail.com"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Official website (Russian language only):" Margin="0,0,5,0"/>
<HyperlinkButton Foreground="Red" Content="http://foxgame.hol.es/" Padding="0" NavigateUri="http://foxgame.hol.es/"/>
</StackPanel>
<TextBlock/>
<TextBlock Text="Legal stuff" FontSize="22" FontWeight="SemiBold"/>
<HyperlinkButton Foreground="Red" Content="Our Privacy Policy" NavigateUri="http://foxgame.hol.es/foxtubepp.txt" Padding="0,5,0,0"/>
<HyperlinkButton Foreground="Red" Content="Privacy Policy" NavigateUri="https://youtube.com/t/privacy" Padding="0"/>
<HyperlinkButton Foreground="Red" Content="Terms of use" NavigateUri="https://youtube.com/t/terms" Padding="0"/>
<HyperlinkButton Foreground="Red" Content="Community Guidelines" NavigateUri="https://youtube.com/t/community_guidelines" Padding="0,0,0,10"/>
<TextBlock Text="© 2018 Michael Gordeev"/>
<TextBlock Text="© 2018 YouTube, LLC"/>
<Image Source="Assets/FoxGame.png" Width="300" HorizontalAlignment="Left" Visibility="Collapsed"/>
</StackPanel>
<Image Grid.Column="1" Source="Assets/LogoAvatar.png" VerticalAlignment="Top"/>
</Grid>
</StackPanel>
<settingspages:About/>
</PivotItem>
<PivotItem Margin="0,-48,0,0">
<local:Translate/>
<settingspages:Translate/>
</PivotItem>
<PivotItem Margin="0,-48,0,0">
<pages:Inbox/>
<settingspages:Inbox/>
</PivotItem>
</Pivot>
</ScrollViewer>
@@ -138,9 +73,6 @@
<HyperlinkButton Name="toGeneral" Click="toGeneral_Click" Foreground="White" Margin="0,0,10,0">
<TextBlock Text="General"/>
</HyperlinkButton>
<HyperlinkButton Foreground="White" Margin="0,0,10,0" Name="toAccount" Click="toAccount_Click">
<TextBlock Text="Account"/>
</HyperlinkButton>
<HyperlinkButton Foreground="White" Margin="0,0,10,0" Name="toFeedback" Click="toFeedback_Click">
<TextBlock Text="Leave feedback"/>
</HyperlinkButton>
+45 -34
View File
@@ -16,6 +16,7 @@ using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using FoxTube.Pages.SettingsPages;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
@@ -27,22 +28,14 @@ namespace FoxTube
public sealed partial class Settings : Page
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
PackageVersion ver = Package.Current.Id.Version;
public Pivot pivot;
public Feedback fb;
public Settings()
{
this.InitializeComponent();
version.Text = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);
pivot = content;
fb = feedbackHub.Content as Feedback;
language.SelectedIndex = (int)settings.Values["language"];
quality.SelectedIndex = (int)settings.Values["quality"];
newVideo.IsChecked = (bool)settings.Values["newVideoNotification"];
newComment.IsChecked = (bool)settings.Values["newCommentNotification"];
newPost.IsChecked = (bool)settings.Values["newPostNotification"];
messages.IsChecked = (bool)settings.Values["newmessagesNotification"];
mobileWarning.IsOn = (bool)settings.Values["moblieWarning"];
@@ -58,6 +51,35 @@ namespace FoxTube
}
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if(!string.IsNullOrWhiteSpace(e.Parameter as string))
{
if((e.Parameter as string).Contains("feedback"))
{
toFeedback_Click(this, null);
if ((string)e.Parameter != "feedback")
{
((pivot.Items[1] as PivotItem).Content as Feedback).PreDefine(Convert.ToBoolean((e.Parameter as string).Split('&', '=')[2]), (e.Parameter as string).Split('&', '=')[4]);
}
}
else
switch(e.Parameter as string)
{
case "about":
toAbout_Click(this, null);
break;
case "translate":
toTranslate_Click(this, null);
break;
case "inbox":
toInbox_Click(this, null);
break;
}
}
}
private void language_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if ((int)settings.Values["language"] != language.SelectedIndex)
@@ -69,8 +91,7 @@ namespace FoxTube
private void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if ((int)settings.Values["quality"] != quality.SelectedIndex)
settings.Values["quality"] = quality.SelectedIndex;
settings.Values["quality"] = quality.SelectedIndex;
}
private void notification_IsEnabledChanged(object sender, RoutedEventArgs e)
@@ -78,12 +99,6 @@ namespace FoxTube
if ((bool)settings.Values["newVideoNotification"] != newVideo.IsChecked)
settings.Values["newVideoNotification"] = newVideo.IsChecked;
if ((bool)settings.Values["newPostNotification"] != newPost.IsChecked)
settings.Values["newPostNotification"] = newPost.IsChecked;
if ((bool)settings.Values["newCommentNotification"] != newComment.IsChecked)
settings.Values["newCommentNotification"] = newComment.IsChecked;
if ((bool)settings.Values["newmessagesNotification"] != messages.IsChecked)
settings.Values["newmessagesNotification"] = messages.IsChecked;
@@ -96,50 +111,46 @@ namespace FoxTube
private void toGeneral_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 0;
pivot.SelectedIndex = 0;
}
private void toFeedback_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 2;
pivot.SelectedIndex = 1;
}
private void toTranslate_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 4;
pivot.SelectedIndex = 3;
}
private void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
toGeneral.FontWeight = FontWeights.Normal;
toAccount.FontWeight = FontWeights.Normal;
toFeedback.FontWeight = FontWeights.Normal;
toAbout.FontWeight = FontWeights.Normal;
toTranslate.FontWeight = FontWeights.Normal;
toInbox.FontWeight = FontWeights.Normal;
if (content.SelectedIndex == 0)
if (pivot.SelectedIndex == 0)
toGeneral.FontWeight = FontWeights.Bold;
else if (content.SelectedIndex == 1)
toAccount.FontWeight = FontWeights.Bold;
else if (content.SelectedIndex == 2)
else if (pivot.SelectedIndex == 1)
toFeedback.FontWeight = FontWeights.Bold;
else if (content.SelectedIndex == 3)
else if (pivot.SelectedIndex == 2)
toAbout.FontWeight = FontWeights.Bold;
else if (content.SelectedIndex == 4)
else if (pivot.SelectedIndex == 3)
toTranslate.FontWeight = FontWeights.Bold;
else if (content.SelectedIndex == 5)
else if (pivot.SelectedIndex == 4)
{
toInbox.FontWeight = FontWeights.Bold;
}
private void toAccount_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 1;
if (!((pivot.SelectedItem as PivotItem).Content as Inbox).Loaded)
((pivot.SelectedItem as PivotItem).Content as Inbox).LoadItems();
}
}
private void toAbout_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 3;
pivot.SelectedIndex = 2;
}
private void region_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -154,7 +165,7 @@ namespace FoxTube
private void toInbox_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 5;
pivot.SelectedIndex = 4;
}
}
}
+56
View File
@@ -0,0 +1,56 @@
<Page
x:Class="FoxTube.Pages.SettingsPages.About"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Pages.SettingsPages"
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 Padding="10" Name="grid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="600"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="grid.ColumnDefinitions[1].Width" Value="auto"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="0"/>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="About us and this app" FontSize="28"/>
<TextBlock Text="FoxTube" FontSize="24"/>
<TextBlock Name="version" Text="[currentVersion]" FontSize="14" Foreground="Gray" Margin="0,-5,0,10"/>
<TextBlock TextWrapping="WrapWholeWords" Text="Developed by Michael Gordeev (also known as XFox)" Margin="0,0,0,10"/>
<TextBlock TextWrapping="WrapWholeWords" Visibility="Collapsed" Text="Special thanks to contributors for motivating me, testers and translators for making this app better everyday and you for using this app;)" Margin="0,0,0,10"/>
<TextBlock Text="Contacts" FontSize="22" FontWeight="SemiBold"/>
<TextBlock>Twitter: <Hyperlink NavigateUri="https://twitter.com/XFox_Mike" Foreground="Red">@XFox_Mike</Hyperlink></TextBlock>
<TextBlock>Vkontakte: <Hyperlink NavigateUri="https://vk.com/XFox.Mike" Foreground="Red">@XFox.Mike</Hyperlink></TextBlock>
<TextBlock>YouTube: <Hyperlink NavigateUri="https://youtube.com/c/FoxGameStudioChannel" Foreground="Red">@FoxGameStudioChannel</Hyperlink></TextBlock>
<TextBlock>E-mail: <Hyperlink NavigateUri="mailto:michael.xfox@outlook.com" Foreground="Red">michael.xfox@outlook.com</Hyperlink></TextBlock>
<TextBlock Margin="0,0,0,10">My blog (Russian language only): <Hyperlink NavigateUri="https://michael-xfox.com" Foreground="Red">https://michael-xfox.com</Hyperlink></TextBlock>
<TextBlock Text="Legal stuff" FontSize="22" FontWeight="SemiBold"/>
<HyperlinkButton Foreground="Red" Content="Our Privacy Policy" NavigateUri="https://michael-xfox.com/foxtubepp.txt" Padding="0,5,0,0"/>
<HyperlinkButton Foreground="Red" Content="YouTube Privacy Policy" NavigateUri="https://youtube.com/t/privacy" Padding="0"/>
<HyperlinkButton Foreground="Red" Content="YouTube Terms of use" NavigateUri="https://youtube.com/t/terms" Padding="0"/>
<HyperlinkButton Foreground="Red" Content="YouTube Community Guidelines" NavigateUri="https://youtube.com/t/community_guidelines" Padding="0,0,0,10"/>
<TextBlock Text="© 2018 Michael Gordeev"/>
<TextBlock Text="© 2018 YouTube, LLC"/>
</StackPanel>
<Image Grid.Column="1" Source="/Assets/LogoAvatar.png" VerticalAlignment="Top" Width="128"/>
</Grid>
</Page>
+33
View File
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
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.Pages.SettingsPages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class About : Page
{
PackageVersion ver = Package.Current.Id.Version;
public About()
{
this.InitializeComponent();
version.Text = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);
}
}
}
@@ -1,5 +1,5 @@
<Page
x:Class="FoxTube.Feedback"
x:Class="FoxTube.Pages.SettingsPages.Feedback"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube"
@@ -22,7 +22,7 @@ using System.Diagnostics;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube
namespace FoxTube.Pages.SettingsPages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
@@ -1,5 +1,5 @@
<Page
x:Class="FoxTube.Pages.Inbox"
x:Class="FoxTube.Pages.SettingsPages.Inbox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Pages"
@@ -19,19 +19,19 @@ using System.Diagnostics;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Pages
namespace FoxTube.Pages.SettingsPages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Inbox : Page
{
public bool Loaded = false;
List<InboxItem> backup = new List<InboxItem>();
List<InboxItem> items = new List<InboxItem>();
public Inbox()
{
this.InitializeComponent();
LoadItems();
}
public async void LoadItems()
@@ -1,5 +1,5 @@
<Page
x:Class="FoxTube.Translate"
x:Class="FoxTube.Pages.SettingsPages.Translate"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube"
@@ -21,7 +21,7 @@ using Windows.UI.Popups;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube
namespace FoxTube.Pages.SettingsPages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
+36 -2
View File
@@ -6,11 +6,45 @@
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:ui="using:Microsoft.Advertising.WinRT.UI"
x:Name="root"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<controls:AdaptiveGridView Name="list" OneRowModeEnabled="False" DesiredWidth="384" SelectionMode="None"/>
<TextBlock Name="empty" Text="&#xD8;" FontSize="200" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="728"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ad.Width" Value="728"/>
<Setter Target="ad.Height" Value="90"/>
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ad.Width" Value="640"/>
<Setter Target="ad.Height" Value="100"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ui:AdControl VerticalAlignment="Top" Name="ad"
ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"
AdUnitId="test"
Height="50"
Width="300"/>
<controls:AdaptiveGridView Name="list" OneRowModeEnabled="False" DesiredWidth="384" SelectionMode="None" Grid.Row="1"/>
<TextBlock Name="empty" Text="&#xD8;" FontSize="200" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.RowSpan="2"/>
</Grid>
</Page>