diff --git a/FoxTube/Controls/ChannelCard.xaml.cs b/FoxTube/Controls/ChannelCard.xaml.cs index 8b2c746..93e6da4 100644 --- a/FoxTube/Controls/ChannelCard.xaml.cs +++ b/FoxTube/Controls/ChannelCard.xaml.cs @@ -23,7 +23,7 @@ namespace FoxTube.Controls public sealed partial class ChannelCard : UserControl { string channelId; - Google.Apis.YouTube.v3.Data.Channel item; + Channel item; public ChannelCard(string id, string live = "null") { diff --git a/FoxTube/Controls/CommentCard.xaml b/FoxTube/Controls/CommentCard.xaml index 5fea065..57788ed 100644 --- a/FoxTube/Controls/CommentCard.xaml +++ b/FoxTube/Controls/CommentCard.xaml @@ -91,10 +91,9 @@ Content="" /> - + - - + diff --git a/FoxTube/Controls/CommentCard.xaml.cs b/FoxTube/Controls/CommentCard.xaml.cs index 3412d27..0e51b33 100644 --- a/FoxTube/Controls/CommentCard.xaml.cs +++ b/FoxTube/Controls/CommentCard.xaml.cs @@ -26,6 +26,8 @@ namespace FoxTube.Controls public enum CommentType { TopLevel, Reply } public sealed partial class CommentCard : UserControl { + ShowMore more; + Comment item; CommentThread thread; CommentType type = CommentType.TopLevel; @@ -34,6 +36,7 @@ namespace FoxTube.Controls public CommentCard(CommentThread comment) { this.InitializeComponent(); + more = repliesPlaceholder.Children[1] as ShowMore; Initialize(comment); } @@ -65,26 +68,21 @@ namespace FoxTube.Controls try { avatar.ProfilePicture = new BitmapImage(new Uri(comment.Snippet.TopLevelComment.Snippet.AuthorProfileImageUrl)); } catch { } - if (comment.Replies != null && comment.Replies.Comments.Count > 0) + if(comment.Snippet.TotalReplyCount > 0) { - if (comment.Replies.Comments.Count <= 5) - foreach (Comment reply in comment.Replies.Comments) - replies.Children.Add(new CommentCard(reply)); + var request = SecretsVault.Service.Comments.List("snippet"); + request.ParentId = item.Id; + request.MaxResults = 10; + + var response = await request.ExecuteAsync(); + + if (response.NextPageToken != null) + NextPageToken = response.NextPageToken; else - { - var request = SecretsVault.NoAuthService.Comments.List("snippet"); - request.ParentId = item.Id; - var response = await request.ExecuteAsync(); + more.Visibility = Visibility.Collapsed; - if(response.NextPageToken != null) - { - NextPageToken = response.NextPageToken; - more.Visibility = Visibility.Visible; - } - - foreach (Comment c in response.Items) - replies.Children.Add(new CommentCard(c)); - } + foreach (Comment c in response.Items) + replies.Children.Add(new CommentCard(c)); } } @@ -139,25 +137,24 @@ namespace FoxTube.Controls Methods.MainPage.GoToChannel(item.Snippet.AuthorChannelId.ToString().Split('"')[3]); } - private async void more_Click(object sender, RoutedEventArgs e) + private async void more_Click() { - more.Visibility = Visibility.Collapsed; - moreLoading.Visibility = Visibility.Visible; - var request = SecretsVault.NoAuthService.Comments.List("snippet"); request.ParentId = item.Id; + request.MaxResults = 10; request.PageToken = NextPageToken; var response = await request.ExecuteAsync(); foreach (Comment c in response.Items) replies.Children.Add(new CommentCard(c)); - + if (response.NextPageToken != null) { NextPageToken = response.NextPageToken; - more.Visibility = Visibility.Visible; + more.Complete(); } - moreLoading.Visibility = Visibility.Collapsed; + else + more.Complete(true); } private void reply_TextChanged(object sender, TextChangedEventArgs e) diff --git a/FoxTube/Controls/VideoPlayer.xaml.cs b/FoxTube/Controls/VideoPlayer.xaml.cs index f31aa83..0827f88 100644 --- a/FoxTube/Controls/VideoPlayer.xaml.cs +++ b/FoxTube/Controls/VideoPlayer.xaml.cs @@ -85,7 +85,7 @@ namespace FoxTube Timer countdown; - public VideoPlayer(Google.Apis.YouTube.v3.Data.Video meta, string channelAvatar) + public VideoPlayer() { this.InitializeComponent(); if (!ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay)) @@ -102,7 +102,6 @@ namespace FoxTube t.Elapsed += T_Elapsed; seekTimer.Elapsed += SeekTimer_Elapsed; - Initialize(meta, channelAvatar); } public async void Initialize(Google.Apis.YouTube.v3.Data.Video meta, string channelAvatar) diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj index 6fc1623..812523d 100644 --- a/FoxTube/FoxTube.csproj +++ b/FoxTube/FoxTube.csproj @@ -168,14 +168,11 @@ Settings.xaml - - SubLayer.xaml - Translate.xaml - - Video.xaml + + VideoPage.xaml VideoCard.xaml @@ -366,15 +363,11 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - Designer MSBuild:Compile - + Designer MSBuild:Compile diff --git a/FoxTube/Pages/ChannelPage.xaml.cs b/FoxTube/Pages/ChannelPage.xaml.cs index 0abfbf6..2b57676 100644 --- a/FoxTube/Pages/ChannelPage.xaml.cs +++ b/FoxTube/Pages/ChannelPage.xaml.cs @@ -102,7 +102,7 @@ namespace FoxTube.Pages } catch { } - description.Text = item.Snippet.Description; + Methods.FormatText(ref description, item.Snippet.Description); views.Text = $"{item.Statistics.ViewCount:0,0}"; registration.Text = item.Snippet.PublishedAt.ToString(); @@ -171,7 +171,7 @@ namespace FoxTube.Pages if (!string.IsNullOrWhiteSpace(response.NextPageToken)) playlistToken = response.NextPageToken; else - playlistMore.Complete(true); + playlistMore.Visibility = Visibility.Collapsed; playlistLoading.Close(); } diff --git a/FoxTube/Pages/CommentsPage.xaml.cs b/FoxTube/Pages/CommentsPage.xaml.cs index 3531cd8..2fdff4f 100644 --- a/FoxTube/Pages/CommentsPage.xaml.cs +++ b/FoxTube/Pages/CommentsPage.xaml.cs @@ -37,7 +37,7 @@ namespace FoxTube.Pages this.InitializeComponent(); } - public async void Initialize(Google.Apis.YouTube.v3.Data.Video video) + public async void Initialize(Video video) { threadId = video.Id; @@ -46,7 +46,7 @@ namespace FoxTube.Pages counter.Text = string.Format("{0:0,0} Comments", video.Statistics.CommentCount); - var request = SecretsVault.NoAuthService.CommentThreads.List("snippet,replies"); + var request = SecretsVault.Service.CommentThreads.List("snippet,replies"); request.Order = order; request.VideoId = video.Id; request.TextFormat = CommentThreadsResource.ListRequest.TextFormatEnum.PlainText; @@ -67,7 +67,7 @@ namespace FoxTube.Pages more.Visibility = Visibility.Collapsed; moreLoading.Visibility = Visibility.Visible; - var request = SecretsVault.NoAuthService.CommentThreads.List("snippet,replies"); + var request = SecretsVault.Service.CommentThreads.List("snippet,replies"); request.Order = order; request.VideoId = threadId; request.TextFormat = CommentThreadsResource.ListRequest.TextFormatEnum.PlainText; @@ -97,7 +97,7 @@ namespace FoxTube.Pages placeholder.Children.Clear(); - var request = SecretsVault.NoAuthService.CommentThreads.List("snippet,replies"); + var request = SecretsVault.Service.CommentThreads.List("snippet,replies"); request.Order = order; request.VideoId = threadId; request.TextFormat = CommentThreadsResource.ListRequest.TextFormatEnum.PlainText; @@ -124,7 +124,7 @@ namespace FoxTube.Pages placeholder.Children.Clear(); - var request = SecretsVault.NoAuthService.CommentThreads.List("snippet,replies"); + var request = SecretsVault.Service.CommentThreads.List("snippet,replies"); request.Order = order; request.VideoId = threadId; var response = await request.ExecuteAsync(); diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs index 3bccfa2..d808a05 100644 --- a/FoxTube/Pages/MainPage.xaml.cs +++ b/FoxTube/Pages/MainPage.xaml.cs @@ -440,7 +440,7 @@ namespace FoxTube videoPlaceholder.HorizontalAlignment = HorizontalAlignment.Stretch; videoPlaceholder.Margin = new Thickness(0); - videoPlaceholder.Navigate(typeof(Video), id); + videoPlaceholder.Navigate(typeof(VideoPage), id); } public void GoToDeveloper(string id) @@ -458,7 +458,7 @@ namespace FoxTube private void Page_SizeChanged(object sender, SizeChangedEventArgs e) { if (videoPlaceholder.Content != null) - (videoPlaceholder.Content as Video).player.UpdateSize(); + (videoPlaceholder.Content as VideoPage).player.UpdateSize(); if(isForcedCollapsed) { diff --git a/FoxTube/Pages/PlaylistPage.xaml.cs b/FoxTube/Pages/PlaylistPage.xaml.cs index b52a8bb..46f50b8 100644 --- a/FoxTube/Pages/PlaylistPage.xaml.cs +++ b/FoxTube/Pages/PlaylistPage.xaml.cs @@ -50,7 +50,7 @@ namespace FoxTube.Pages { base.OnNavigatedTo(e); if (e.Parameter == null) - loading.Error("NullReferenceException", "Unable to initialize search. Search term is not stated."); + loading.Error("NullReferenceException", "Unable to initialize page. Playlist ID is not stated."); else Initialize(e.Parameter as string); } diff --git a/FoxTube/Pages/Video.xaml b/FoxTube/Pages/Video.xaml deleted file mode 100644 index 31deedd..0000000 --- a/FoxTube/Pages/Video.xaml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FoxTube/Pages/VideoPage.xaml b/FoxTube/Pages/VideoPage.xaml new file mode 100644 index 0000000..b980372 --- /dev/null +++ b/FoxTube/Pages/VideoPage.xaml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FoxTube/Pages/Video.xaml.cs b/FoxTube/Pages/VideoPage.xaml.cs similarity index 71% rename from FoxTube/Pages/Video.xaml.cs rename to FoxTube/Pages/VideoPage.xaml.cs index 97f3d1f..4ee1671 100644 --- a/FoxTube/Pages/Video.xaml.cs +++ b/FoxTube/Pages/VideoPage.xaml.cs @@ -35,41 +35,39 @@ using FoxTube.Controls; // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 -namespace FoxTube +namespace FoxTube.Pages { public enum Rating { None, Like, Dislike } /// /// An empty page that can be used on its own or navigated to within a Frame. /// - public sealed partial class Video : Page + public sealed partial class VideoPage : Page { ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; string videoId; - Google.Apis.YouTube.v3.Data.Video item; + Video item; List downloads = new List(); bool wide; bool isExtended = false; - bool isAddedToLater = false; Rating userRating = Rating.None; public VideoPlayer player; public CommentsPage comments; - LoadingPage LoadingScreen = new LoadingPage(); - LoadingPage loadingRelated = new LoadingPage(); + LoadingPage loading; - System.Timers.Timer streamUpdateTimer; - - public Video() + public VideoPage() { this.InitializeComponent(); - mainGrid.Children.Add(LoadingScreen); - relatedGrid.Children.Add(loadingRelated); - LoadingScreen.RefreshPage += LoadingScreen_RefreshPage; + loading = grid.Children[3] as LoadingPage; + loading.RefreshPage += refresh_Click; + player = mainContent.Children[0] as VideoPlayer; + player.SetFullSize += Player_SetFullSize; + comments = commentsPlaceholder.Content as CommentsPage; DataTransferManager.GetForCurrentView().DataRequested += new TypedEventHandler(Share); @@ -90,71 +88,47 @@ namespace FoxTube grid.ColumnDefinitions[1].Width = new GridLength(0); pivot.SelectedIndex = 0; - pivot_SelectionChanged(this, null); } } + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + if (e.Parameter == null) + loading.Error("NullReferenceException", "Unable to initialize page. Video ID is not stated."); + else + Initialize(e.Parameter as string); + } + public async void Initialize(string id) { + loading.Refresh(); + try { - grid.Visibility = Visibility.Collapsed; - LoadingScreen.Refresh(); - LoadingScreen.Visibility = Visibility.Visible; videoId = id; - VideosResource.ListRequest request = SecretsVault.NoAuthService.Videos.List("snippet,contentDetails,statistics,status,liveStreamingDetails"); + VideosResource.ListRequest request = SecretsVault.Service.Videos.List("snippet,statistics,status,contentDetails"); request.Id = id; + item = (await request.ExecuteAsync()).Items[0]; - VideoListResponse response = await request.ExecuteAsync(); - item = response.Items[0]; - - if (item.Snippet.LiveBroadcastContent == "live") - { - views.Text = string.Format("{0:0,0} viewers", item.LiveStreamingDetails.ConcurrentViewers); - streamUpdateTimer = new System.Timers.Timer(10000); - streamUpdateTimer.Elapsed += StreamUpdateTimer_Elapsed; - toComments.Visibility = Visibility.Collapsed; - pivot.Items.RemoveAt(pivot.Items.Count - 1); - //(toComments.Content as TextBlock).Text = "Chat"; - } - else - { - views.Text = string.Format("{0:0,0} views", item.Statistics.ViewCount); - comments = new CommentsPage(); - commentsPlaceholder.Content = null; - commentsPlaceholder.Content = comments; - comments.Initialize(item); - } - - VideoCategoriesResource.ListRequest categoryRequest = SecretsVault.NoAuthService.VideoCategories.List("snippet"); - categoryRequest.Id = item.Snippet.CategoryId; - VideoCategoryListResponse categoryResponse = await categoryRequest.ExecuteAsync(); - VideoCategory cat = categoryResponse.Items[0]; - category.Text = cat.Snippet.Title; + title.Text = item.Snippet.Title; + Methods.FormatText(ref description, item.Snippet.Description); + publishedAt.Text = item.Snippet.PublishedAt.ToString(); if (item.Status.License == "youtube") license.Text = "Standard YouTube License"; else license.Text = "Creative Commons Attribution license (reuse allowed)"; - publishedAt.Text = item.Snippet.PublishedAt.Value.ToString("d, MMMM, yyyy"); - title.Text = item.Snippet.Title; - dislikes.Text = item.Statistics.DislikeCount.ToString(); - likes.Text = item.Statistics.LikeCount.ToString(); + VideoCategoriesResource.ListRequest categoryRequest = SecretsVault.NoAuthService.VideoCategories.List("snippet"); + categoryRequest.Id = item.Snippet.CategoryId; + category.Text = (await categoryRequest.ExecuteAsync()).Items[0].Snippet.Title; + + views.Text = $"{item.Statistics.ViewCount:0,0} views"; + dislikes.Text = $"{item.Statistics.DislikeCount:0,0}"; + likes.Text = $"{item.Statistics.LikeCount:0,0}"; rating.Value = (double)item.Statistics.DislikeCount / (double)(item.Statistics.DislikeCount + item.Statistics.LikeCount) * 100; - Methods.FormatText(ref description, item.Snippet.Description); - ChannelsResource.ListRequest request1 = SecretsVault.NoAuthService.Channels.List("snippet,contentDetails,statistics"); - request1.Id = item.Snippet.ChannelId; - - ChannelListResponse response1 = await request1.ExecuteAsync(); - var item1 = response1.Items[0]; - - channelAvatar.ProfilePicture = new BitmapImage(new Uri(item1.Snippet.Thumbnails.Medium.Url)); - channelName.Text = item.Snippet.ChannelTitle; - subscribers.Text = string.Format("{0:0,0} subscribers", item1.Statistics.SubscriberCount); - - - if(SecretsVault.IsAuthorized) + if (SecretsVault.IsAuthorized) { VideoGetRatingResponse ratingResponse = await SecretsVault.Service.Videos.GetRating(id).ExecuteAsync(); if (ratingResponse.Items[0].Rating == "like") @@ -168,55 +142,40 @@ namespace FoxTube dislike.Foreground = new SolidColorBrush(Colors.Red); } - /*addLater.Visibility = Visibility.Visible; - addToPlaylist.Visibility = Visibility.Visible; - - if (SecretsVault.WatchLater.Contains(item.Id)) + foreach (Subscription s in SecretsVault.Subscriptions) { - isAddedToLater = true; - addLater.IsChecked = true; - }*/ + if (s.Snippet.ResourceId.ChannelId == item.Snippet.ChannelId) + { + subscribe.IsChecked = true; + subscribe.Content = "Subscribed"; + } + } + subscribe.Visibility = Visibility.Visible; } - player = new VideoPlayer(item, item1.Snippet.Thumbnails.Medium.Url); - player.SetFullSize += Player_SetFullSize; + ChannelsResource.ListRequest channelRequest = SecretsVault.Service.Channels.List("snippet, statistics"); + channelRequest.Id = item.Snippet.ChannelId; + var item1 = (await channelRequest.ExecuteAsync()).Items[0]; - playerPlaceholder.Children.Add(player); + channelAvatar.ProfilePicture = new BitmapImage(new Uri(item1.Snippet.Thumbnails.Medium.Url)); + channelName.Text = item.Snippet.ChannelTitle; + subscribers.Text = $"{item1.Statistics.SubscriberCount:0,0} subscribers"; + comments.Initialize(item); + player.Initialize(item, item1.Snippet.Thumbnails.Medium.Url); + LoadRelatedVideos(); LoadDownloads(); - Thread.Sleep(1000); - grid.Visibility = Visibility.Visible; - LoadingScreen.Visibility = Visibility.Collapsed; - - LoadRelatedVideos(); - - /*if (SecretsVault.IsAuthorized && SecretsVault.UserHistory[0] != item.Id) - { - await SecretsVault.Service.PlaylistItems.Insert(new PlaylistItem() - { - Snippet = new PlaylistItemSnippet() - { - ResourceId = new ResourceId() - { - Kind = "youtube#video", - VideoId = item.Id - }, - PlaylistId = SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchHistory - } - }, "snippet").ExecuteAsync(); - SecretsVault.UserHistory.Insert(0, item.Id); - }*/ + loading.Close(); } catch { - LoadingScreen.Error(); + loading.Error(); } } async void LoadDownloads() { - Debug.WriteLine("Loading download options..."); downloadSelector.Items.Clear(); YouTubeUri[] uris = await YouTube.GetUrisAsync(item.Id); @@ -239,14 +198,13 @@ namespace FoxTube MenuFlyoutItem menuItem = new MenuFlyoutItem() { Text = Methods.QualityToString(u.AudioQuality) - }; + }; menuItem.Click += downloadItemSelected; downloadSelector.Items.Add(menuItem); } } else download.Visibility = Visibility.Collapsed; - Debug.WriteLine("Done"); } private void downloadItemSelected(object sender, RoutedEventArgs e) @@ -256,10 +214,7 @@ namespace FoxTube async void LoadRelatedVideos() { - loadingRelated.Refresh(); - loadingRelated.Visibility = Visibility.Visible; - - SearchResource.ListRequest request = SecretsVault.IsAuthorized? SecretsVault.Service.Search.List("snippet") : SecretsVault.NoAuthService.Search.List("snippet"); + SearchResource.ListRequest request = SecretsVault.Service.Search.List("snippet"); request.RelatedToVideoId = videoId; request.SafeSearch = (SearchResource.ListRequest.SafeSearchEnum)(int)settings.Values["safeSearch"]; request.MaxResults = 20; @@ -269,32 +224,6 @@ namespace FoxTube foreach (SearchResult video in response.Items) relatedVideos.Children.Add(new VideoCard(video.Id.VideoId)); - - loadingRelated.Visibility = Visibility.Collapsed; - } - - private async void StreamUpdateTimer_Elapsed(object sender, ElapsedEventArgs e) - { - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, UpdateStreamDetails); - } - - async void UpdateStreamDetails() - { - VideosResource.ListRequest request = SecretsVault.NoAuthService.Videos.List("statistics,liveStreamingDetails"); - request.Id = videoId; - - VideoListResponse response = await request.ExecuteAsync(); - var itemTemp = response.Items[0]; - - if (itemTemp.Snippet.LiveBroadcastContent == "live") - { - views.Text = itemTemp.LiveStreamingDetails.ConcurrentViewers + " viewers"; - - dislikes.Text = itemTemp.Statistics.DislikeCount.ToString(); - likes.Text = itemTemp.Statistics.LikeCount.ToString(); - rating.Value = (double)itemTemp.Statistics.DislikeCount / (double)(itemTemp.Statistics.DislikeCount + itemTemp.Statistics.LikeCount) * 100; - } - else streamUpdateTimer.Stop(); } private void Player_SetFullSize(object sender, EventArgs e) @@ -330,7 +259,7 @@ namespace FoxTube private void gotoChannel_Click(object sender, RoutedEventArgs e) { - ((Window.Current.Content as Frame).Content as MainPage).GoToChannel(item.Snippet.ChannelId); + Methods.MainPage.GoToChannel(item.Snippet.ChannelId); } private async void openBrowser_Click(object sender, RoutedEventArgs e) @@ -339,22 +268,15 @@ namespace FoxTube string timecode = player.elapsed.TotalSeconds > 10 ? "&t=" + (int)player.elapsed.TotalSeconds + "s" : string.Empty; - await Launcher.LaunchUriAsync(new Uri(string.Format("https://www.youtube.com/watch?v={0}{1}", videoId, timecode))); + await Launcher.LaunchUriAsync(new Uri($"https://www.youtube.com/watch?v={videoId}{timecode}")); } private void refresh_Click(object sender, RoutedEventArgs e) { - playerPlaceholder.Children.Clear(); - player = null; - + player = new VideoPlayer(); Initialize(videoId); } - private void LoadingScreen_RefreshPage(object sender, RoutedEventArgs e) - { - refresh_Click(this, null); - } - private void grid_SizeChanged(object sender, SizeChangedEventArgs e) { if (e.NewSize.Width > 1000) @@ -578,35 +500,5 @@ namespace FoxTube break; } } - - private async void addLater_Click(object sender, RoutedEventArgs e) - { - isAddedToLater = !isAddedToLater; - if(isAddedToLater) - { - PlaylistItem pi = await SecretsVault.Service.PlaylistItems.Insert(new PlaylistItem() - { - Snippet = new PlaylistItemSnippet() - { - ResourceId = new ResourceId() - { - Kind = "youtube#video", - VideoId = item.Id - }, - PlaylistId = SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater - } - }, "snippet").ExecuteAsync(); - SecretsVault.WatchLater.Insert(0, pi); - } - else - { - //await SecretsVault.Service.PlaylistItems.Delete(SecretsVault.WatchLater[]) - } - } - - private void addToPlaylist_Click(object sender, RoutedEventArgs e) - { - - } } } diff --git a/FoxTube/SubLayer.xaml b/FoxTube/SubLayer.xaml deleted file mode 100644 index 725b47c..0000000 --- a/FoxTube/SubLayer.xaml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/FoxTube/SubLayer.xaml.cs b/FoxTube/SubLayer.xaml.cs deleted file mode 100644 index 25740ba..0000000 --- a/FoxTube/SubLayer.xaml.cs +++ /dev/null @@ -1,60 +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.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 SubLayer : Page - { - public MainPage Main = new MainPage(); - public Frame Fullscreen = new Frame(); - - Video initialParent; - - public SubLayer() - { - this.InitializeComponent(); - grid.Children.Add(Main); - grid.Children.Add(Fullscreen); - } - - public void EnterFullScreen(VideoPlayer element, Video initParent) - { - initialParent = initParent; - if(grid.Children.Contains(element)) - { - grid.Children.Remove(element); - //initialParent.SetPlayerBack(); - initialParent = null; - } - else - grid.Children.Add(element); - /*Fullscreen.Content = element; - Fullscreen.Visibility = Visibility.Visible;*/ - } - - public void ExitFullScreen() - { - grid.Children.RemoveAt(1); - //initialParent.SetPlayerBack(); - /*Fullscreen.Content = null; - Fullscreen.Visibility = Visibility.Collapsed;*/ - } - } -}