diff --git a/FoxTube/About.xaml b/FoxTube/About.xaml
index 587c430..13be59f 100644
--- a/FoxTube/About.xaml
+++ b/FoxTube/About.xaml
@@ -23,7 +23,7 @@
-
+
@@ -31,7 +31,7 @@
-
+
@@ -51,9 +51,9 @@
-
+
-
+
diff --git a/FoxTube/Assets/videoThumbSample.png b/FoxTube/Assets/videoThumbSample.png
new file mode 100644
index 0000000..28c0f63
Binary files /dev/null and b/FoxTube/Assets/videoThumbSample.png differ
diff --git a/FoxTube/ChannelCard.xaml b/FoxTube/ChannelCard.xaml
new file mode 100644
index 0000000..8c38112
--- /dev/null
+++ b/FoxTube/ChannelCard.xaml
@@ -0,0 +1,36 @@
+
+
+
+
diff --git a/FoxTube/ChannelCard.xaml.cs b/FoxTube/ChannelCard.xaml.cs
new file mode 100644
index 0000000..6a44152
--- /dev/null
+++ b/FoxTube/ChannelCard.xaml.cs
@@ -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);*/
+ }
+ }
+}
diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj
index 121f385..c0dd4e1 100644
--- a/FoxTube/FoxTube.csproj
+++ b/FoxTube/FoxTube.csproj
@@ -101,6 +101,9 @@
Channel.xaml
+
+ ChannelCard.xaml
+
ChannelVideos.xaml
@@ -121,18 +124,30 @@
+
+ Search.xaml
+
Settings.xaml
Translate.xaml
+
+ Video.xaml
+
VideoCard.xaml
+
+ VideoCardWide.xaml
+
VideoGrid.xaml
+
+ VideoList.xaml
+
@@ -182,6 +197,7 @@
+
@@ -208,6 +224,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -232,6 +252,10 @@
MSBuild:Compile
Designer
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -240,14 +264,26 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
diff --git a/FoxTube/MainPage.xaml b/FoxTube/MainPage.xaml
index c10dced..b5d8b8e 100644
--- a/FoxTube/MainPage.xaml
+++ b/FoxTube/MainPage.xaml
@@ -101,18 +101,18 @@
-
-
+
-
+
-
+
@@ -199,7 +199,7 @@
-
+
@@ -212,7 +212,10 @@
-
+
+
+
+
diff --git a/FoxTube/MainPage.xaml.cs b/FoxTube/MainPage.xaml.cs
index 56eb055..dbcec21 100644
--- a/FoxTube/MainPage.xaml.cs
+++ b/FoxTube/MainPage.xaml.cs
@@ -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);
+ }
}
}
diff --git a/FoxTube/Search.xaml b/FoxTube/Search.xaml
new file mode 100644
index 0000000..c0a1b6f
--- /dev/null
+++ b/FoxTube/Search.xaml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FoxTube/Search.xaml.cs b/FoxTube/Search.xaml.cs
new file mode 100644
index 0000000..2123f13
--- /dev/null
+++ b/FoxTube/Search.xaml.cs
@@ -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
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ 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");
+ }
+ }
+}
diff --git a/FoxTube/Video.xaml b/FoxTube/Video.xaml
new file mode 100644
index 0000000..e787a82
--- /dev/null
+++ b/FoxTube/Video.xaml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FoxTube/Video.xaml.cs b/FoxTube/Video.xaml.cs
new file mode 100644
index 0000000..55d8d95
--- /dev/null
+++ b/FoxTube/Video.xaml.cs
@@ -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
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ public sealed partial class Video : Page
+ {
+ public Video()
+ {
+ this.InitializeComponent();
+ }
+ }
+}
diff --git a/FoxTube/VideoCard.xaml b/FoxTube/VideoCard.xaml
index 9924e0d..806859b 100644
--- a/FoxTube/VideoCard.xaml
+++ b/FoxTube/VideoCard.xaml
@@ -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">