theme switch fix, channel search filters fix, search in browser added
This commit is contained in:
@@ -73,7 +73,7 @@
|
|||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
<CommandBar Grid.Row="1" DefaultLabelPosition="Right">
|
<CommandBar Grid.Row="1" DefaultLabelPosition="Right">
|
||||||
<AppBarButton Label="Open in browser" Icon="Globe" Name="inBrowser" Click="inBrowser_Click" IsEnabled="False"/>
|
<AppBarButton Label="Open in browser" Icon="Globe" Name="inBrowser" Click="inBrowser_Click"/>
|
||||||
<AppBarButton Label="Refresh" Icon="Refresh" Click="AppBarButton_Click"/>
|
<AppBarButton Label="Refresh" Icon="Refresh" Click="AppBarButton_Click"/>
|
||||||
</CommandBar>
|
</CommandBar>
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using Windows.UI.Xaml.Data;
|
|||||||
using Windows.UI.Xaml.Input;
|
using Windows.UI.Xaml.Input;
|
||||||
using Windows.UI.Xaml.Media;
|
using Windows.UI.Xaml.Media;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
|
using Windows.System;
|
||||||
|
|
||||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ namespace FoxTube
|
|||||||
public sealed partial class Search : Page
|
public sealed partial class Search : Page
|
||||||
{
|
{
|
||||||
public string Term;
|
public string Term;
|
||||||
bool isChannel = false;
|
string channelId = null;
|
||||||
SearchResource.ListRequest request;
|
SearchResource.ListRequest request;
|
||||||
string nextToken;
|
string nextToken;
|
||||||
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||||
@@ -66,7 +67,7 @@ namespace FoxTube
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "youtube#channel":
|
case "youtube#channel":
|
||||||
if(!isChannel)
|
if(channelId != null)
|
||||||
{
|
{
|
||||||
ChannelCard cCard = new ChannelCard(result.Id.ChannelId/*, result.Snippet.LiveBroadcastContent*/);
|
ChannelCard cCard = new ChannelCard(result.Id.ChannelId/*, result.Snippet.LiveBroadcastContent*/);
|
||||||
list.Add(cCard);
|
list.Add(cCard);
|
||||||
@@ -99,10 +100,10 @@ namespace FoxTube
|
|||||||
|
|
||||||
public void Initialize(SearchParameters arg)
|
public void Initialize(SearchParameters arg)
|
||||||
{
|
{
|
||||||
Initialize(arg.Term, channelId: arg.ChannelId);
|
Initialize(arg.Term, channel: arg.ChannelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Initialize(string term, bool forceInitialization = false, string channelId = null)
|
public async void Initialize(string term, bool forceInitialization = false, string channel = null)
|
||||||
{
|
{
|
||||||
if (term == Term && !forceInitialization)
|
if (term == Term && !forceInitialization)
|
||||||
return;
|
return;
|
||||||
@@ -112,10 +113,10 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
Term = term;
|
Term = term;
|
||||||
request = SecretsVault.Service.Search.List("id");
|
request = SecretsVault.Service.Search.List("id");
|
||||||
if (!string.IsNullOrWhiteSpace(channelId))
|
if (!string.IsNullOrWhiteSpace(channel))
|
||||||
{
|
{
|
||||||
isChannel = true;
|
channelId = channel;
|
||||||
request.ChannelId = channelId;
|
request.ChannelId = channel;
|
||||||
(grid.Children[1] as CommandBar).Visibility = Visibility.Collapsed;
|
(grid.Children[1] as CommandBar).Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
request.Q = term;
|
request.Q = term;
|
||||||
@@ -267,7 +268,7 @@ namespace FoxTube
|
|||||||
|
|
||||||
private void AppBarButton_Click(object sender, RoutedEventArgs e)
|
private void AppBarButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Initialize(Term, true);
|
Initialize(Term, true, channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void more_Clicked()
|
private async void more_Clicked()
|
||||||
@@ -304,9 +305,9 @@ namespace FoxTube
|
|||||||
catch (NullReferenceException) { }
|
catch (NullReferenceException) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void inBrowser_Click(object sender, RoutedEventArgs e)
|
private async void inBrowser_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
await Launcher.LaunchUriAsync(new Uri($"https://www.youtube.com/results?search_query={searchTerm}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.Runtime.InteropServices.WindowsRuntime;
|
|||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
|
using Windows.UI;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Controls.Primitives;
|
using Windows.UI.Xaml.Controls.Primitives;
|
||||||
@@ -94,24 +95,24 @@ namespace FoxTube.Pages.SettingsPages
|
|||||||
|
|
||||||
private void RadioButton_Checked(object sender, RoutedEventArgs e)
|
private void RadioButton_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender == light)
|
if (sender == light && (int)settings.Values["themeMode"] != 0)
|
||||||
{
|
{
|
||||||
settings.Values["themeMode"] = 0;
|
settings.Values["themeMode"] = 0;
|
||||||
Application.Current.RequestedTheme = ApplicationTheme.Light;
|
Methods.MainPage.RequestedTheme = ElementTheme.Light;
|
||||||
}
|
}
|
||||||
if (sender == dark)
|
if (sender == dark && (int)settings.Values["themeMode"] != 1)
|
||||||
{
|
{
|
||||||
settings.Values["themeMode"] = 1;
|
settings.Values["themeMode"] = 1;
|
||||||
Application.Current.RequestedTheme = ApplicationTheme.Dark;
|
Methods.MainPage.RequestedTheme = ElementTheme.Dark;
|
||||||
}
|
}
|
||||||
if (sender == system)
|
if (sender == system && (int)settings.Values["themeMode"] != 2)
|
||||||
{
|
{
|
||||||
settings.Values["themeMode"] = 2;
|
settings.Values["themeMode"] = 2;
|
||||||
string uiTheme = (new Windows.UI.ViewManagement.UISettings()).GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString();
|
Color uiTheme = (new Windows.UI.ViewManagement.UISettings()).GetColorValue(Windows.UI.ViewManagement.UIColorType.Background);
|
||||||
if (uiTheme == "#FF000000")
|
if (uiTheme == Colors.Black)
|
||||||
Application.Current.RequestedTheme = ApplicationTheme.Dark;
|
Methods.MainPage.RequestedTheme = ElementTheme.Dark;
|
||||||
else
|
else
|
||||||
Application.Current.RequestedTheme = ApplicationTheme.Light;
|
Methods.MainPage.RequestedTheme = ElementTheme.Light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user