diff --git a/FoxTube/App.xaml.cs b/FoxTube/App.xaml.cs
index 2882eb7..23e4051 100644
--- a/FoxTube/App.xaml.cs
+++ b/FoxTube/App.xaml.cs
@@ -66,7 +66,7 @@ namespace FoxTube
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
- rootFrame.Navigate(typeof(MainPage), e.Arguments);
+ rootFrame.Navigate(typeof(SubLayer), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
diff --git a/FoxTube/ChannelCard.xaml.cs b/FoxTube/ChannelCard.xaml.cs
index 566182b..eb5a296 100644
--- a/FoxTube/ChannelCard.xaml.cs
+++ b/FoxTube/ChannelCard.xaml.cs
@@ -59,9 +59,7 @@ namespace FoxTube
private void Button_Click(object sender, RoutedEventArgs e)
{
- Frame root = Window.Current.Content as Frame;
- MainPage main = root.Content as MainPage;
- main.GoToChannel(channelId);
+ SecretsVault.SubLayer.Main.GoToChannel(channelId);
}
}
}
diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj
index 0cb2d89..23ae61d 100644
--- a/FoxTube/FoxTube.csproj
+++ b/FoxTube/FoxTube.csproj
@@ -129,6 +129,9 @@
Settings.xaml
+
+ SubLayer.xaml
+
Translate.xaml
@@ -255,6 +258,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/FoxTube/MainPage.xaml.cs b/FoxTube/MainPage.xaml.cs
index 329d4c6..f39341d 100644
--- a/FoxTube/MainPage.xaml.cs
+++ b/FoxTube/MainPage.xaml.cs
@@ -542,36 +542,6 @@ namespace FoxTube
}
}
- public static string NormalizeDuration(string code)
- {
- Debug.WriteLine(string.Format("Source string: '{0}'", code));
- string temp = code.Trim('P', 'T', 'S');
- Debug.WriteLine(string.Format("Trimmed string: '{0}'", temp));
- temp = temp.Replace('H', '|');
- temp = temp.Replace('M', '|');
- if (temp.StartsWith('|'))
- temp.TrimStart('|');
- if (temp.EndsWith('|'))
- temp.TrimEnd('|');
- Debug.WriteLine(string.Format("End string: '{0}'", temp));
- string[] arr = temp.Split('|');
- Debug.WriteLine(string.Format("Array length: {0}", arr.Length));
- foreach (string str in arr)
- Debug.WriteLine(str);
-
- switch(arr.Length)
- {
- case 3:
- return new TimeSpan(Convert.ToInt32(arr[0]), Convert.ToInt32(arr[1]), Convert.ToInt32(arr[2])).ToString();
- case 2:
- return new TimeSpan(0, Convert.ToInt32(arr[0]), Convert.ToInt32(arr[1])).ToString();
- case 1:
- return new TimeSpan(0, 0, Convert.ToInt32(arr[0])).ToString();
- default:
- return "";
- }
- }
-
private void searchSuggestionsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if(e.AddedItems.Count > 0)
diff --git a/FoxTube/SecretsVault.cs b/FoxTube/SecretsVault.cs
index 15eb4e9..9e98ee7 100644
--- a/FoxTube/SecretsVault.cs
+++ b/FoxTube/SecretsVault.cs
@@ -7,6 +7,8 @@ using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using Google.Apis.YouTube.v3;
using Google.Apis.Auth.OAuth2.Flows;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
namespace FoxTube
{
@@ -96,5 +98,15 @@ namespace FoxTube
#region Authorization service functions
#endregion
+
+ #region Simplifying stuff
+ public static SubLayer SubLayer
+ {
+ get
+ {
+ return (Window.Current.Content as Frame).Content as SubLayer;
+ }
+ }
+ #endregion
}
}
diff --git a/FoxTube/Settings.xaml b/FoxTube/Settings.xaml
index 3ccfe8f..504bfa1 100644
--- a/FoxTube/Settings.xaml
+++ b/FoxTube/Settings.xaml
@@ -35,6 +35,7 @@
+
diff --git a/FoxTube/SubLayer.xaml b/FoxTube/SubLayer.xaml
new file mode 100644
index 0000000..725b47c
--- /dev/null
+++ b/FoxTube/SubLayer.xaml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/FoxTube/SubLayer.xaml.cs b/FoxTube/SubLayer.xaml.cs
new file mode 100644
index 0000000..1624c65
--- /dev/null
+++ b/FoxTube/SubLayer.xaml.cs
@@ -0,0 +1,60 @@
+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;*/
+ }
+ }
+}
diff --git a/FoxTube/Video.xaml.cs b/FoxTube/Video.xaml.cs
index d87ca86..2f5a8be 100644
--- a/FoxTube/Video.xaml.cs
+++ b/FoxTube/Video.xaml.cs
@@ -30,6 +30,8 @@ namespace FoxTube
string videoId;
Google.Apis.YouTube.v3.Data.Video item;
+ VideoPlayer player;
+
public Video()
{
this.InitializeComponent();
@@ -45,11 +47,11 @@ namespace FoxTube
item = response.Items[0];
title.Text = item.Snippet.Title;
- views.Text = item.Statistics.ViewCount + " views";
+ /*views.Text = item.Statistics.ViewCount + " views";
dislikes.Text = item.Statistics.DislikeCount.ToString();
likes.Text = item.Statistics.LikeCount.ToString();
Debug.WriteLine((double)item.Statistics.DislikeCount / (double)(item.Statistics.DislikeCount + item.Statistics.LikeCount) * 250);
- dislikeLine.X2 = (double)item.Statistics.DislikeCount / (double)(item.Statistics.DislikeCount + item.Statistics.LikeCount) * 250;
+ dislikeLine.X2 = (double)item.Statistics.DislikeCount / (double)(item.Statistics.DislikeCount + item.Statistics.LikeCount) * 250;*/
description.Text = item.Snippet.Description;
ChannelsResource.ListRequest request1 = SecretsVault.YoutubeService.Channels.List("snippet,contentDetails,statistics");
@@ -62,7 +64,21 @@ namespace FoxTube
channelName.Text = item.Snippet.ChannelTitle;
subscribers.Text = item1.Statistics.SubscriberCount + " subscribers";
- mainContent.Children.Add(new VideoPlayer(id, item1.Snippet.Thumbnails.Medium.Url));
+ player = new VideoPlayer(id, item1.Snippet.Thumbnails.Medium.Url);
+ player.SetFullSize += Player_SetFullSize;
+
+ mainContent.Children.Add(player);
+ }
+
+ private void Player_SetFullSize(object sender, EventArgs e)
+ {
+ mainContent.Children.Clear();
+ SecretsVault.SubLayer.EnterFullScreen(player, this);
+ }
+
+ public void SetPlayerBack()
+ {
+ mainContent.Children.Add(player);
}
private void gotoChannel_Click(object sender, RoutedEventArgs e)
diff --git a/FoxTube/VideoCard.xaml.cs b/FoxTube/VideoCard.xaml.cs
index 73386f6..c96f5ec 100644
--- a/FoxTube/VideoCard.xaml.cs
+++ b/FoxTube/VideoCard.xaml.cs
@@ -73,7 +73,7 @@ namespace FoxTube
private void Button_Click(object sender, RoutedEventArgs e)
{
- ((Window.Current.Content as Frame).Content as MainPage).GoToVideo(videoId);
+ SecretsVault.SubLayer.Main.GoToVideo(videoId);
}
}
}
diff --git a/FoxTube/VideoCardWide.xaml.cs b/FoxTube/VideoCardWide.xaml.cs
index 8d30f6f..d883604 100644
--- a/FoxTube/VideoCardWide.xaml.cs
+++ b/FoxTube/VideoCardWide.xaml.cs
@@ -70,12 +70,12 @@ namespace FoxTube
private void channelLink_Click(object sender, RoutedEventArgs e)
{
- ((Window.Current.Content as Frame).Content as MainPage).GoToChannel(item.Snippet.ChannelId);
+ SecretsVault.SubLayer.Main.GoToChannel(item.Snippet.ChannelId);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
- ((Window.Current.Content as Frame).Content as MainPage).GoToVideo(videoId);
+ SecretsVault.SubLayer.Main.GoToVideo(videoId);
}
}
}
diff --git a/FoxTube/VideoPlayer.xaml b/FoxTube/VideoPlayer.xaml
index 50ac744..1c77ee0 100644
--- a/FoxTube/VideoPlayer.xaml
+++ b/FoxTube/VideoPlayer.xaml
@@ -20,9 +20,9 @@
-
+
-
+