Search system
This commit is contained in:
+4
-4
@@ -23,7 +23,7 @@
|
||||
<TextBlock Text="Contacts" FontSize="22" FontWeight="SemiBold"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Twitter:" Margin="0,0,5,0"/>
|
||||
<HyperlinkButton Content="@XFoxGameStudio" Padding="0" NavigateUri="https://twitter.com/FoxGameStudio"/>
|
||||
<HyperlinkButton 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"/>
|
||||
@@ -31,7 +31,7 @@
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="VKontakte:" Margin="0,0,5,0"/>
|
||||
<HyperlinkButton Content="@FoxGameOfficial" Padding="0" NavigateUri="https://vk.com/foxgameofficial"/>
|
||||
<HyperlinkButton Content="@XFox.Mike" Padding="0" NavigateUri="https://vk.com/XFox.Mike"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="YouTube:" Margin="0,0,5,0"/>
|
||||
@@ -51,9 +51,9 @@
|
||||
<HyperlinkButton Content="Privacy Policy" NavigateUri="https://youtube.com/t/privacy" Padding="0"/>
|
||||
<HyperlinkButton Content="Terms of use" NavigateUri="https://youtube.com/t/terms" Padding="0"/>
|
||||
<HyperlinkButton Content="Community Guidelines" NavigateUri="https://youtube.com/t/community_guidelines" Padding="0,0,0,10"/>
|
||||
<TextBlock Text="© 2018 FoxGame Studio"/>
|
||||
<TextBlock Text="© 2018 Michael Gordeev"/>
|
||||
<TextBlock Text="© 2018 YouTube, LLC"/>
|
||||
<Image Source="Assets/FoxGame.png" Width="300" HorizontalAlignment="Left"/>
|
||||
<Image Source="Assets/FoxGame.png" Width="300" HorizontalAlignment="Left" Visibility="Collapsed"/>
|
||||
</StackPanel>
|
||||
<Image Grid.Column="1" Source="Assets/LogoAvatar.png" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
@@ -0,0 +1,36 @@
|
||||
<UserControl
|
||||
x:Class="FoxTube.ChannelCard"
|
||||
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"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="150">
|
||||
|
||||
<Button Padding="0" Background="WhiteSmoke" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Margin="2" VerticalAlignment="Stretch" Click="Button_Click">
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<PersonPicture Name="avatar" Width="125"/>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="1" Padding="10,5,5,5" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Name="channelName" Text="IGP" FontSize="18"/>
|
||||
<StackPanel Name="liveTag" Margin="5,0,0,0" BorderBrush="Red" BorderThickness="2" VerticalAlignment="Center" HorizontalAlignment="Right" Padding="5,0,5,0" Height="20" Orientation="Horizontal" Visibility="Collapsed">
|
||||
<TextBlock Text=" " VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" FontSize="12" FontFamily="Segoe MDL2 Assets" Margin="0,1,0,0" FontWeight="Black"/>
|
||||
<TextBlock Text="LIVE" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" FontSize="12" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<TextBlock Name="subscribers" Text="120,452 subscribers" Foreground="Gray"/>
|
||||
<TextBlock Name="videoCount" Foreground="Gray" Text="563,000 videos"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
|
||||
<ToggleButton Grid.Column="2" Height="40" Width="200" Background="Red" Foreground="White" FontSize="18" FontWeight="SemiBold" Content="Subscirbe"/>
|
||||
<ToggleButton Grid.Column="3" Height="40" Width="40" FontFamily="Segoe MDL2 Assets" FontSize="18" FontWeight="SemiBold" Content="" Foreground="White" Background="Red"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Button>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
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.Media.Imaging;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
namespace FoxTube
|
||||
{
|
||||
public sealed partial class ChannelCard : UserControl
|
||||
{
|
||||
string channelId;
|
||||
public ChannelCard()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
public void AddInfo(string name, int videos, string avatarUrl, string channelUrl, int subs, Visibility live)
|
||||
{
|
||||
channelName.Text = name;
|
||||
videoCount.Text = string.Format("{0} videos", videos);
|
||||
|
||||
avatar.ProfilePicture = new BitmapImage(new Uri(avatarUrl));
|
||||
|
||||
subscribers.Text = string.Format("{0} subscribers", subs);
|
||||
|
||||
channelId = channelUrl;
|
||||
liveTag.Visibility = live;
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
/*Debug.WriteLine(channelId);
|
||||
Process.Start(channelId);*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,6 +101,9 @@
|
||||
<Compile Include="Channel.xaml.cs">
|
||||
<DependentUpon>Channel.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ChannelCard.xaml.cs">
|
||||
<DependentUpon>ChannelCard.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ChannelVideos.xaml.cs">
|
||||
<DependentUpon>ChannelVideos.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -121,18 +124,30 @@
|
||||
</Compile>
|
||||
<Compile Include="Notification.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Search.xaml.cs">
|
||||
<DependentUpon>Search.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Settings.xaml.cs">
|
||||
<DependentUpon>Settings.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Translate.xaml.cs">
|
||||
<DependentUpon>Translate.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Video.xaml.cs">
|
||||
<DependentUpon>Video.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VideoCard.xaml.cs">
|
||||
<DependentUpon>VideoCard.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VideoCardWide.xaml.cs">
|
||||
<DependentUpon>VideoCardWide.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VideoGrid.xaml.cs">
|
||||
<DependentUpon>VideoGrid.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VideoList.xaml.cs">
|
||||
<DependentUpon>VideoList.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
@@ -182,6 +197,7 @@
|
||||
<Content Include="Assets\StoreLogo.scale-150.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-200.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-400.png" />
|
||||
<Content Include="Assets\videoThumbSample.png" />
|
||||
<Content Include="Assets\WhatsNewThumb.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-100.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-125.png" />
|
||||
@@ -208,6 +224,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ChannelCard.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ChannelVideos.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -232,6 +252,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Search.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Settings.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -240,14 +264,26 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Video.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="VideoCard.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="VideoCardWide.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="VideoGrid.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="VideoList.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Apis">
|
||||
|
||||
@@ -101,18 +101,18 @@
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</Popup>
|
||||
<TextBox Name="searchField" Grid.Column="8" ToolTipService.ToolTip="Search" Margin="4" Width="350" Height="50" Padding="14,10,5,0" PlaceholderText="Search" BorderThickness="0" Background="#7FFFFFFF" Text=""/>
|
||||
<Button Name="searchButton" Grid.Column="8" HorizontalAlignment="Right"
|
||||
<TextBox KeyUp="searchField_KeyUp" Name="searchField" Grid.Column="8" ToolTipService.ToolTip="Search" Margin="4" Width="350" Height="50" Padding="14,10,5,0" PlaceholderText="Search" BorderThickness="0" Background="#7FFFFFFF" Text="" TextChanged="searchField_TextChanged" LostFocus="searchField_LostFocus"/>
|
||||
<Button Name="searchButton" Grid.Column="8" HorizontalAlignment="Right" Click="searchButton_Click"
|
||||
Width="42" Height="42" Margin="4"
|
||||
RelativePanel.AlignRightWithPanel="True"
|
||||
Background="Transparent"
|
||||
FontFamily="Segoe MDL2 Assets" Content="" FontSize="20" FocusVisualSecondaryBrush="#66FFFFFF" FocusVisualPrimaryBrush="White" Foreground="Black"/>
|
||||
<Popup Margin="0,50,0,0" Grid.Column="9" Name="searchSuggestions" IsOpen="False">
|
||||
<Popup Margin="0,50,0,0" Grid.Column="9" Name="searchSuggestions" IsOpen="True" Visibility="Collapsed">
|
||||
<StackPanel>
|
||||
<StackPanel Width="350" Background="WhiteSmoke" Name="searchStandby">
|
||||
<TextBlock Padding="10,0,0,0" Text="Loading results... Please, wait."/>
|
||||
</StackPanel>
|
||||
<StackPanel Name="searchSuggestionsList">
|
||||
<StackPanel Name="searchSuggestionsList" Visibility="Collapsed">
|
||||
<ListBox Width="350">
|
||||
<ListBoxItem Height="35" Padding="10,0,0,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
@@ -199,7 +199,7 @@
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Height="100" IsEnabled="False" Name="subsLogErr" Visibility="Visible" VerticalContentAlignment="Top">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock FontFamily="Default, Segoe MDL2 Assets" Text="Press  and add an account to see your featured channels and more content here" Width="225" HorizontalTextAlignment="Center" Foreground="Gray" TextWrapping="WrapWholeWords"/>
|
||||
<TextBlock FontFamily="Default, Segoe MDL2 Assets" Text="Press  and add an account to see your featured channels and another useful stuff here" Width="225" HorizontalTextAlignment="Center" Foreground="Gray" TextWrapping="WrapWholeWords"/>
|
||||
</StackPanel>
|
||||
</ListBoxItem>
|
||||
</ListBox>
|
||||
@@ -212,7 +212,10 @@
|
||||
</ListBoxItem>
|
||||
</ListBox>
|
||||
<ListBox RelativePanel.AlignBottomWithPanel="True" SelectionChanged="bottomHaburgerSelectionChanged" Name="bottomHaburger">
|
||||
<ListBoxItem Name="channelMenu" Visibility="Visible">
|
||||
<ListBoxItem Padding="0" IsEnabled="False">
|
||||
<Line X1="0" X2="250" Stroke="Black" StrokeThickness="1"/>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Name="channelMenu" Visibility="Collapsed">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Style="{StaticResource ItemIcon}" Text=""/>
|
||||
<TextBlock Style="{StaticResource MenuItem}" Text="My channel"/>
|
||||
|
||||
@@ -212,21 +212,21 @@ namespace FoxTube
|
||||
menu.DisplayMode = SplitViewDisplayMode.CompactInline;
|
||||
menu.IsPaneOpen = true;
|
||||
}
|
||||
else if (bottomHaburger.SelectedIndex == 3)
|
||||
else if (bottomHaburger.SelectedIndex == 4)
|
||||
{
|
||||
content.Navigate(typeof(Settings));
|
||||
headerText.Text = "Settings";
|
||||
menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
|
||||
menu.IsPaneOpen = false;
|
||||
}
|
||||
else if (bottomHaburger.SelectedIndex == 0)
|
||||
else if (bottomHaburger.SelectedIndex == 1)
|
||||
{
|
||||
content.Navigate(typeof(Channel));
|
||||
headerText.Text = "Channel overview";
|
||||
menu.DisplayMode = SplitViewDisplayMode.CompactOverlay;
|
||||
menu.IsPaneOpen = false;
|
||||
}
|
||||
else if (bottomHaburger.SelectedIndex == 2)
|
||||
else if (bottomHaburger.SelectedIndex == 3)
|
||||
{
|
||||
if(content.SourcePageType == typeof(Settings))
|
||||
bottomHaburger.SelectedIndex = 3;
|
||||
@@ -260,7 +260,7 @@ namespace FoxTube
|
||||
|
||||
private void feddback_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
bottomHaburger.SelectedIndex = 3;
|
||||
bottomHaburger.SelectedIndex = 4;
|
||||
Settings s = content.Content as Settings;
|
||||
s.content.Navigate(typeof(Feedback));
|
||||
}
|
||||
@@ -330,5 +330,60 @@ namespace FoxTube
|
||||
);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void searchField_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (searchField.Text != "")
|
||||
{
|
||||
searchSuggestions.Visibility = Visibility.Visible;
|
||||
buildSearchSuggestionsTree(searchField.Text);
|
||||
}
|
||||
else searchField_LostFocus(this, null);
|
||||
}
|
||||
|
||||
async void buildSearchSuggestionsTree(string keyword)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void searchField_LostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
searchSuggestions.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void searchButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
StartSearch(searchField.Text);
|
||||
}
|
||||
|
||||
private async void StartSearch(string keyword)
|
||||
{
|
||||
content.Navigate(typeof(Search));
|
||||
|
||||
YouTubeService ytService = new YouTubeService(new BaseClientService.Initializer()
|
||||
{
|
||||
ApiKey = "INSERT_API_HERE",
|
||||
ApplicationName = this.GetType().ToString()
|
||||
});
|
||||
|
||||
var searchListRequest = ytService.Search.List("snippet");
|
||||
searchListRequest.Q = keyword;
|
||||
searchListRequest.MaxResults = 25;
|
||||
|
||||
var response = await searchListRequest.ExecuteAsync();
|
||||
|
||||
Search s = content.Content as Search;
|
||||
s.SetResults(keyword, (int)response.PageInfo.TotalResults);
|
||||
Debug.WriteLine("building items tree...");
|
||||
foreach (SearchResult result in response.Items)
|
||||
s.AddItem(result);
|
||||
Debug.WriteLine("done");
|
||||
}
|
||||
|
||||
private void searchField_KeyUp(object sender, KeyRoutedEventArgs e)
|
||||
{
|
||||
if (e.Key == Windows.System.VirtualKey.Enter)
|
||||
StartSearch(searchField.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<Page
|
||||
x:Class="FoxTube.Search"
|
||||
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}">
|
||||
<ScrollViewer>
|
||||
<StackPanel Orientation="Vertical" Margin="10">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Search results for: " FontSize="28"/>
|
||||
<TextBlock Name="searchTerm" Text="[searchTerm]" FontSize="28" Margin="10,0,0,0"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Found:" FontSize="14" Foreground="Gray" Margin="0,-5,0,10"/>
|
||||
<TextBlock Name="resultsCount" Text="[resultsCount]" FontSize="14" Foreground="Gray" Margin="5,-5,0,10"/>
|
||||
<TextBlock Text="items" FontSize="14" Foreground="Gray" Margin="5,-5,0,10"/>
|
||||
</StackPanel>
|
||||
<HyperlinkButton Content="Show filters " FontFamily="Default, Segoe MDL2 Assets" FontSize="18" Visibility="Collapsed"/>
|
||||
<Grid Background="WhiteSmoke" Padding="5" Visibility="Collapsed">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Type" FontSize="20"/>
|
||||
<Line StrokeThickness="1" Stroke="Gray" X1="0" X2="150"/>
|
||||
<RadioButton Content="All" IsChecked="True"/>
|
||||
<RadioButton Content="Videos"/>
|
||||
<RadioButton Content="Channels"/>
|
||||
<RadioButton Content="Playlists"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<StackPanel Name="resultsList" Orientation="Vertical">
|
||||
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,99 @@
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class Search : Page
|
||||
{
|
||||
public Search()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetResults(string keyword, int count)
|
||||
{
|
||||
searchTerm.Text = keyword;
|
||||
if (count == 1000000)
|
||||
resultsCount.Text = count + "+";
|
||||
else
|
||||
resultsCount.Text = count.ToString();
|
||||
}
|
||||
|
||||
public void AddItem(SearchResult result)
|
||||
{
|
||||
switch (result.Id.Kind)
|
||||
{
|
||||
case "youtube#video":
|
||||
AddVideo(result.Snippet.Title,
|
||||
"null", "null", result.Snippet.PublishedAt,
|
||||
result.Snippet.ChannelTitle, "null",
|
||||
result.Snippet.ChannelId, result.Snippet.Thumbnails.Medium.Url, "null", result.Snippet.LiveBroadcastContent);
|
||||
break;
|
||||
|
||||
case "youtube#channel":
|
||||
AddChannel(result.Snippet.Title, 0, 0,
|
||||
result.Snippet.ChannelId, result.Snippet.Thumbnails.Medium.Url, result.Snippet.LiveBroadcastContent);
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.WriteLine("Skipped");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void AddVideo(string title,
|
||||
string duration, string views, DateTime? publicDate,
|
||||
string channelName, string subs,
|
||||
string channelId, string thumbUrl, string avatarUrl, string liveBroadcast)
|
||||
{
|
||||
Visibility live;
|
||||
if (liveBroadcast != "live")
|
||||
live = Visibility.Collapsed;
|
||||
else live = Visibility.Visible;
|
||||
|
||||
VideoCardWide card = new VideoCardWide();
|
||||
card.AddInfo(title,
|
||||
string.Format("{0} | {1} | {2}", duration, views, publicDate),
|
||||
thumbUrl, avatarUrl, string.Format("https://www.youtube.com/channel/{0}", channelId),
|
||||
channelName, subs, live);
|
||||
|
||||
resultsList.Children.Add(card);
|
||||
Debug.WriteLine("result item added");
|
||||
}
|
||||
|
||||
void AddChannel(string name, int followers, int uploads,
|
||||
string url, string avatar, string liveBroadcast)
|
||||
{
|
||||
Visibility live;
|
||||
if (liveBroadcast != "live")
|
||||
live = Visibility.Collapsed;
|
||||
else live = Visibility.Visible;
|
||||
|
||||
ChannelCard card = new ChannelCard();
|
||||
card.AddInfo(name, uploads, avatar,
|
||||
"https://www.youtube.com/channel/" + url, followers, live);
|
||||
|
||||
resultsList.Children.Add(card);
|
||||
Debug.WriteLine("result item added");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<Page
|
||||
x:Class="FoxTube.Video"
|
||||
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}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Background="Black"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,30 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class Video : Page
|
||||
{
|
||||
public Video()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
-14
@@ -6,40 +6,51 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="290"
|
||||
d:DesignWidth="390">
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
SizeChanged="UserControl_SizeChanged">
|
||||
|
||||
<Button Padding="0" Background="Transparent" VerticalAlignment="Top">
|
||||
<Grid Background="WhiteSmoke" BorderBrush="LightGray" BorderThickness="1" Width="384" Height="290">
|
||||
<Grid Background="WhiteSmoke" BorderBrush="LightGray" BorderThickness="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="75"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Background="Red" Padding="0,-35,0,0">
|
||||
<Grid Grid.Row="0" Background="Black">
|
||||
<Image Source="Assets/videoThumbSample.png" Stretch="Fill"/>
|
||||
<StackPanel Margin="0,0,5,5" Background="WhiteSmoke" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,0" Height="20">
|
||||
<TextBlock Text="1:00:00 | 59 minute ago" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="12"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,0,5,30" Background="Red" BorderBrush="White" BorderThickness="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,0,5,0" Height="20" Orientation="Horizontal" Visibility="Collapsed">
|
||||
<TextBlock Text=" " VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="12" FontFamily="Segoe MDL2 Assets" Margin="0,1,0,0" FontWeight="Black"/>
|
||||
<TextBlock Text="LIVE" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="12" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<!--<StackPanel Grid.Row="0" Background="Red">
|
||||
<Image Source="https://i.ytimg.com/vi/f8iOcZ43YT0/hqdefault.jpg"/>
|
||||
<StackPanel Margin="0,-100,2,0" Background="WhiteSmoke" HorizontalAlignment="Right" Padding="5,0,3,0" Height="20">
|
||||
<StackPanel Margin="0,0,2,0" Background="WhiteSmoke" HorizontalAlignment="Right" Padding="5,0,3,0" Height="20">
|
||||
<TextBlock Text="1:00:00" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" Margin="0,2,2,0" FontSize="12"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>-->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="5*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="75"/>
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="160"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Ellipse Grid.Column="0" Height="50" Width="50" Margin="10,-30,10,10" Fill="WhiteSmoke"/>
|
||||
<PersonPicture Grid.Column="0" Height="46" Margin="10,-30,10,0" BorderBrush="White" BorderThickness="10" ProfilePicture="https://yt3.ggpht.com/-UOhOJaAitUc/AAAAAAAAAAI/AAAAAAAAAAA/z3WPfWpVuZw/s88-c-k-no-mo-rj-c0xffffff/photo.jpg"/>
|
||||
<Ellipse Grid.Column="0" Height="50" Width="50" Margin="5,-30,5,10" Fill="WhiteSmoke"/>
|
||||
<PersonPicture Grid.Column="0" Height="46" Margin="5,-30,5,0" BorderBrush="White" BorderThickness="10" ProfilePicture="https://yt3.ggpht.com/-UOhOJaAitUc/AAAAAAAAAAI/AAAAAAAAAAA/z3WPfWpVuZw/s88-c-k-no-mo-rj-c0xffffff/photo.jpg"/>
|
||||
|
||||
<TextBlock Grid.Column="1" Text="IGP" Foreground="Gray" Margin="0,2,0,0" FontSize="12"/>
|
||||
<TextBlock Grid.Column="2" Text="1M views | 59 minute ago" HorizontalAlignment="Right" Foreground="Gray" Margin="0,2,2,0" FontSize="12"/>
|
||||
<TextBlock Grid.Column="2" Text="1M views" HorizontalAlignment="Right" Foreground="Gray" Margin="0,2,2,0" FontSize="12"/>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="1">
|
||||
<TextBlock Text="Subnautica - SAY GOODBYE TO SUBNAUTICA! We're Back Home! - Subnautica Ending (Full Release Gameplay)" TextWrapping="WrapWholeWords" Margin="5" FontSize="14"/>
|
||||
<TextBlock Text="Subnautica - SAY GOODBYE TO SUBNAUTICA! We're Back Home! - Subnautica Ending (Full Release Gameplay)" TextWrapping="WrapWholeWords" Margin="5" FontSize="14" MaxLines="2"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
@@ -23,5 +24,10 @@ namespace FoxTube
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
Height = e.NewSize.Width * 0.75;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<UserControl
|
||||
x:Class="FoxTube.VideoCardWide"
|
||||
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"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="175">
|
||||
|
||||
<Button Padding="0" Background="WhiteSmoke" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Margin="2">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Name="thumbnail" Source="Assets/videoThumbSample.png"/>
|
||||
<Grid Margin="10" HorizontalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="75"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Name="title" TextWrapping="WrapWholeWords" Text="Subnautica - SAY GOODBYE TO SUBNAUTICA! We're Back Home! - Subnautica Ending (Full Release Gameplay)" FontSize="20" MaxLines="2"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Name="info" Text="1:00:00 | 59 minute ago | 1,052,421 views" Foreground="Gray"/>
|
||||
<StackPanel Name="liveTag" Margin="5,0,0,0" BorderBrush="Red" BorderThickness="2" VerticalAlignment="Center" HorizontalAlignment="Right" Padding="5,0,5,0" Height="20" Orientation="Horizontal" Visibility="Collapsed">
|
||||
<TextBlock Text=" " VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" FontSize="12" FontFamily="Segoe MDL2 Assets" Margin="0,1,0,0" FontWeight="Black"/>
|
||||
<TextBlock Text="LIVE" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" FontSize="12" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!--<TextBlock MaxLines="4" Foreground="Gray" Margin="0,5,0,0" Text="Bendy and the Ink Machine: Chapter 4 Gameplay Part 1 - The Most Horrific Thing Yet! Bertrum Boss Fight! - Welcome back to Bendy and the Ink Machine! Today in Bendy and the Ink Machine, we check out Chapter 4, the latest and most terrifying chapter yet! We discover new secrets and find a man alive...kind of. Let's play Bendy and the Ink Machine Chapter 4!"/>-->
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="75"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<PersonPicture Name="avatar" Width="75" HorizontalAlignment="Left"/>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="1" Padding="10,5,5,5" VerticalAlignment="Center">
|
||||
<TextBlock Name="channelName" Text="IGP" FontSize="18"/>
|
||||
<TextBlock Name="channelSubs" Text="120,452 subscribers" Foreground="Gray"/>
|
||||
<HyperlinkButton Name="channelLink" Content="Go to channel" Padding="0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,41 @@
|
||||
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.Media.Imaging;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
namespace FoxTube
|
||||
{
|
||||
public sealed partial class VideoCardWide : UserControl
|
||||
{
|
||||
public VideoCardWide()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
public void AddInfo(string name, string description, string thumbUrl, string avatarUrl, string channelUrl, string channel, string subs, Visibility live)
|
||||
{
|
||||
title.Text = name;
|
||||
info.Text = description;
|
||||
|
||||
thumbnail.Source = new BitmapImage(new Uri(thumbUrl));
|
||||
//avatar.ProfilePicture = new BitmapImage(new Uri(avatarUrl));
|
||||
|
||||
channelName.Text = channel;
|
||||
channelSubs.Text = string.Format("{0} subscribers", subs);
|
||||
channelLink.NavigateUri = new Uri(channelUrl);
|
||||
liveTag.Visibility = live;
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
-2
@@ -13,8 +13,30 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<local:VideoCard/>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0">
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="1">
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="2">
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="3">
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
<local:VideoCard/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<Page
|
||||
x:Class="FoxTube.VideoList"
|
||||
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}">
|
||||
<ScrollViewer>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,30 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class VideoList : Page
|
||||
{
|
||||
public VideoList()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
Reference in New Issue
Block a user