diff --git a/FoxTube/ChannelCard.xaml b/FoxTube/ChannelCard.xaml index d26e5ab..8f6ac65 100644 --- a/FoxTube/ChannelCard.xaml +++ b/FoxTube/ChannelCard.xaml @@ -26,7 +26,7 @@ - + diff --git a/FoxTube/ChannelCard.xaml.cs b/FoxTube/ChannelCard.xaml.cs index 6a44152..1da04fc 100644 --- a/FoxTube/ChannelCard.xaml.cs +++ b/FoxTube/ChannelCard.xaml.cs @@ -27,7 +27,7 @@ namespace FoxTube this.InitializeComponent(); } - public void AddInfo(string name, int videos, string avatarUrl, string channelUrl, int subs, Visibility live) + public void AddInfo(string name, int videos, string avatarUrl, string channelUrl, int subs, Visibility live, bool logged) { channelName.Text = name; videoCount.Text = string.Format("{0} videos", videos); @@ -38,6 +38,9 @@ namespace FoxTube channelId = channelUrl; liveTag.Visibility = live; + + if (!logged) + subscriptionPane.Visibility = Visibility.Collapsed; } private void Button_Click(object sender, RoutedEventArgs e) diff --git a/FoxTube/MainPage.xaml.cs b/FoxTube/MainPage.xaml.cs index 17a0da0..2687f96 100644 --- a/FoxTube/MainPage.xaml.cs +++ b/FoxTube/MainPage.xaml.cs @@ -38,6 +38,15 @@ namespace FoxTube /// public sealed partial class MainPage : Page { + private bool loggedIn = false; + public bool Logged + { + get + { + return loggedIn; + } + } + ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; List notifications = new List(); public MainPage() @@ -376,6 +385,8 @@ namespace FoxTube private async void StartSearch(string keyword) { content.Navigate(typeof(Search)); + topHamburger.SelectedItem = null; + bottomHaburger.SelectedItem = null; YouTubeService ytService = new YouTubeService(new BaseClientService.Initializer() { @@ -393,14 +404,20 @@ namespace FoxTube s.SetResults(keyword, (int)response.PageInfo.TotalResults); Debug.WriteLine("building items tree..."); foreach (SearchResult result in response.Items) - s.AddItem(result); + s.AddItem(result, Logged); + s.ring.IsActive = false; + s.content.Visibility = Visibility.Visible; Debug.WriteLine("done"); } private void searchField_KeyUp(object sender, KeyRoutedEventArgs e) { if (e.Key == Windows.System.VirtualKey.Enter) + { searchButton_Click(this, null); + content.Focus(FocusState.Pointer); + searchSuggestions.Visibility = Visibility.Collapsed; + } } } } diff --git a/FoxTube/Search.xaml b/FoxTube/Search.xaml index c0a1b6f..cd14a26 100644 --- a/FoxTube/Search.xaml +++ b/FoxTube/Search.xaml @@ -9,34 +9,37 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + diff --git a/FoxTube/Search.xaml.cs b/FoxTube/Search.xaml.cs index 2123f13..dd491d7 100644 --- a/FoxTube/Search.xaml.cs +++ b/FoxTube/Search.xaml.cs @@ -24,9 +24,13 @@ namespace FoxTube /// public sealed partial class Search : Page { + public ProgressRing ring; + public StackPanel content; public Search() { this.InitializeComponent(); + ring = progressRing; + content = displaying; } public void SetResults(string keyword, int count) @@ -38,7 +42,7 @@ namespace FoxTube resultsCount.Text = count.ToString(); } - public void AddItem(SearchResult result) + public void AddItem(SearchResult result, bool logged) { switch (result.Id.Kind) { @@ -51,7 +55,7 @@ namespace FoxTube case "youtube#channel": AddChannel(result.Snippet.Title, 0, 0, - result.Snippet.ChannelId, result.Snippet.Thumbnails.Medium.Url, result.Snippet.LiveBroadcastContent); + result.Snippet.ChannelId, result.Snippet.Thumbnails.Medium.Url, result.Snippet.LiveBroadcastContent, logged); break; default: @@ -81,7 +85,7 @@ namespace FoxTube } void AddChannel(string name, int followers, int uploads, - string url, string avatar, string liveBroadcast) + string url, string avatar, string liveBroadcast, bool logged) { Visibility live; if (liveBroadcast != "live") @@ -90,7 +94,7 @@ namespace FoxTube ChannelCard card = new ChannelCard(); card.AddInfo(name, uploads, avatar, - "https://www.youtube.com/channel/" + url, followers, live); + "https://www.youtube.com/channel/" + url, followers, live, logged); resultsList.Children.Add(card); Debug.WriteLine("result item added");