diff --git a/FoxTube/Controls/ChannelCard.xaml b/FoxTube/Controls/ChannelCard.xaml
index 7ad27ae..0fa457e 100644
--- a/FoxTube/Controls/ChannelCard.xaml
+++ b/FoxTube/Controls/ChannelCard.xaml
@@ -52,4 +52,12 @@
+
+
+
+
+
+
+
+
diff --git a/FoxTube/Controls/ChannelCard.xaml.cs b/FoxTube/Controls/ChannelCard.xaml.cs
index 1c9bea6..91cfce0 100644
--- a/FoxTube/Controls/ChannelCard.xaml.cs
+++ b/FoxTube/Controls/ChannelCard.xaml.cs
@@ -1,26 +1,19 @@
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.ApplicationModel.DataTransfer;
using Windows.Foundation;
-using Windows.Foundation.Collections;
using Windows.UI;
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.Controls
{
+ ///
+ /// Channel item card
+ ///
public sealed partial class ChannelCard : UserControl
{
string channelId;
@@ -28,8 +21,9 @@ namespace FoxTube.Controls
public ChannelCard(string id, string live = "null")
{
- this.InitializeComponent();
+ InitializeComponent();
Initialize(id, live);
+ DataTransferManager.GetForCurrentView().DataRequested += new TypedEventHandler(Share);
}
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
@@ -104,5 +98,26 @@ namespace FoxTube.Controls
subscribe.Content = "Subscribe";
}
}
+
+ private void GetLink_Click(object sender, RoutedEventArgs e)
+ {
+ DataPackage data = new DataPackage();
+ data.SetText(string.IsNullOrWhiteSpace(item.Snippet.CustomUrl) ? $"https://www.youtube.com/channel/{item.Id}" : $"https://www.youtube.com/user/{item.Snippet.CustomUrl}");
+ Clipboard.SetContent(data);
+ }
+
+ private void Share_Click(object sender, RoutedEventArgs e)
+ {
+ DataTransferManager.ShowShareUI();
+ }
+
+ private void Share(DataTransferManager sender, DataRequestedEventArgs args)
+ {
+ Methods.Share(args,
+ item.Snippet.Thumbnails.Medium.Url,
+ item.Snippet.Title,
+ string.IsNullOrWhiteSpace(item.Snippet.CustomUrl) ? $"https://www.youtube.com/channel/{item.Id}" : $"https://www.youtube.com/user/{item.Snippet.CustomUrl}",
+ "channel");
+ }
}
}
diff --git a/FoxTube/Controls/CommentCard.xaml.cs b/FoxTube/Controls/CommentCard.xaml.cs
index 613f38b..33c7389 100644
--- a/FoxTube/Controls/CommentCard.xaml.cs
+++ b/FoxTube/Controls/CommentCard.xaml.cs
@@ -118,7 +118,7 @@ namespace FoxTube.Controls
else
author.Text = comment.Snippet.AuthorDisplayName;
- meta.Text = string.Format("{0} {1}", comment.Snippet.AuthorDisplayName, Methods.GetAgo(comment.Snippet.PublishedAt.Value), comment.Snippet.UpdatedAt.Value != comment.Snippet.PublishedAt.Value ? "(edited)" : "");
+ meta.Text = string.Format("{0} {1}", Methods.GetAgo(comment.Snippet.PublishedAt.Value), comment.Snippet.UpdatedAt != comment.Snippet.PublishedAt ? "(edited)" : "");
Methods.FormatText(ref text, comment.Snippet.TextDisplay);
try { avatar.ProfilePicture = new BitmapImage(new Uri(comment.Snippet.AuthorProfileImageUrl)); }
diff --git a/FoxTube/Controls/PlaylistCard.xaml b/FoxTube/Controls/PlaylistCard.xaml
index 311fc5e..1c4d1ed 100644
--- a/FoxTube/Controls/PlaylistCard.xaml
+++ b/FoxTube/Controls/PlaylistCard.xaml
@@ -48,4 +48,13 @@
+
+
+
+
+
+
+
+
+
diff --git a/FoxTube/Controls/PlaylistCard.xaml.cs b/FoxTube/Controls/PlaylistCard.xaml.cs
index 2064916..b91d6d1 100644
--- a/FoxTube/Controls/PlaylistCard.xaml.cs
+++ b/FoxTube/Controls/PlaylistCard.xaml.cs
@@ -1,6 +1,8 @@
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using System;
+using Windows.ApplicationModel.DataTransfer;
+using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;
@@ -19,6 +21,7 @@ namespace FoxTube.Controls
{
InitializeComponent();
Initialize(id);
+ DataTransferManager.GetForCurrentView().DataRequested += new TypedEventHandler(Share);
}
public async void Initialize(string id)
@@ -54,5 +57,31 @@ namespace FoxTube.Controls
{
Methods.MainPage.GoToPlaylist(item.Id);
}
+
+ private void OpenChannel_Click(object sender, RoutedEventArgs e)
+ {
+ Methods.MainPage.GoToChannel(item.Snippet.ChannelId);
+ }
+
+ private void GetLink_Click(object sender, RoutedEventArgs e)
+ {
+ DataPackage data = new DataPackage();
+ data.SetText($"https://www.youtube.com/playlist?list={playlistId}");
+ Clipboard.SetContent(data);
+ }
+
+ private void Share_Click(object sender, RoutedEventArgs e)
+ {
+ DataTransferManager.ShowShareUI();
+ }
+
+ private void Share(DataTransferManager sender, DataRequestedEventArgs args)
+ {
+ Methods.Share(args,
+ item.Snippet.Thumbnails.Medium.Url,
+ item.Snippet.Title,
+ $"https://www.youtube.com/playlist?list={item.Id}",
+ "playlist");
+ }
}
}
diff --git a/FoxTube/Controls/VideoCard.xaml b/FoxTube/Controls/VideoCard.xaml
index 133eb85..11273f9 100644
--- a/FoxTube/Controls/VideoCard.xaml
+++ b/FoxTube/Controls/VideoCard.xaml
@@ -53,13 +53,18 @@
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/FoxTube/Controls/VideoCard.xaml.cs b/FoxTube/Controls/VideoCard.xaml.cs
index 27cb2e2..1d861ea 100644
--- a/FoxTube/Controls/VideoCard.xaml.cs
+++ b/FoxTube/Controls/VideoCard.xaml.cs
@@ -4,12 +4,16 @@ using Windows.UI.Xaml.Controls;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using Windows.UI.Xaml.Media.Imaging;
-using System.Xml;
using Windows.System;
using Windows.UI.Popups;
+using Windows.ApplicationModel.DataTransfer;
+using Windows.Foundation;
namespace FoxTube.Controls
{
+ ///
+ /// Video item card
+ ///
public sealed partial class VideoCard : UserControl
{
public string playlistId;
@@ -19,8 +23,9 @@ namespace FoxTube.Controls
bool embed = false;
public VideoCard(string id, string playlist = null)
{
- this.InitializeComponent();
+ InitializeComponent();
Initialize(id, playlist);
+ DataTransferManager.GetForCurrentView().DataRequested += new TypedEventHandler(Share);
}
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
@@ -105,5 +110,31 @@ namespace FoxTube.Controls
else
Methods.MainPage.GoToVideo(videoId, playlistId);
}
+
+ private void ViewChannel_Click(object sender, RoutedEventArgs e)
+ {
+ Methods.MainPage.GoToChannel(item.Snippet.ChannelId);
+ }
+
+ private void GetLink_Click(object sender, RoutedEventArgs e)
+ {
+ DataPackage data = new DataPackage();
+ data.SetText($"https://www.youtube.com/watch?v={videoId}");
+ Clipboard.SetContent(data);
+ }
+
+ private void Share_Click(object sender, RoutedEventArgs e)
+ {
+ DataTransferManager.ShowShareUI();
+ }
+
+ private void Share(DataTransferManager sender, DataRequestedEventArgs args)
+ {
+ Methods.Share(args,
+ item.Snippet.Thumbnails.Medium.Url,
+ item.Snippet.Title,
+ $"https://www.youtube.com/watch?v={videoId}",
+ "video");
+ }
}
}
diff --git a/FoxTube/Controls/VideoPlayer.xaml.cs b/FoxTube/Controls/VideoPlayer.xaml.cs
index 8f1194e..2d65a9b 100644
--- a/FoxTube/Controls/VideoPlayer.xaml.cs
+++ b/FoxTube/Controls/VideoPlayer.xaml.cs
@@ -48,9 +48,9 @@ namespace FoxTube
{
miniview = value;
if (value)
- captions.Hide();
+ captions?.Hide();
else
- captions.Show();
+ captions?.Show();
}
}
private bool fullScreen = false;
@@ -178,7 +178,7 @@ namespace FoxTube
systemControls.IsEnabled = true;
#endregion
- videoSource.PosterSource = new BitmapImage(item.Snippet.Thumbnails.Maxres.Url.ToUri());
+ videoSource.PosterSource = new BitmapImage((item.Snippet.Thumbnails.Maxres ?? item.Snippet.Thumbnails.Medium).Url.ToUri());
title.Text = item.Snippet.Title;
channelName.Text = item.Snippet.ChannelTitle;
diff --git a/Src/NewLogoDraftVer2.psd b/Src/NewLogoDraftVer2.psd
new file mode 100644
index 0000000..dacf7a9
Binary files /dev/null and b/Src/NewLogoDraftVer2.psd differ