diff --git a/FoxTube/Pages/Channel.xaml b/FoxTube/Pages/Channel.xaml
index 1b580e9..c8df887 100644
--- a/FoxTube/Pages/Channel.xaml
+++ b/FoxTube/Pages/Channel.xaml
@@ -135,10 +135,11 @@
-
+
+
-
+
diff --git a/FoxTube/Pages/PlaylistPage.xaml b/FoxTube/Pages/PlaylistPage.xaml
index 42b88a4..22929f5 100644
--- a/FoxTube/Pages/PlaylistPage.xaml
+++ b/FoxTube/Pages/PlaylistPage.xaml
@@ -71,6 +71,7 @@
+
diff --git a/FoxTube/Pages/PlaylistPage.xaml.cs b/FoxTube/Pages/PlaylistPage.xaml.cs
index 349387a..02e3fe7 100644
--- a/FoxTube/Pages/PlaylistPage.xaml.cs
+++ b/FoxTube/Pages/PlaylistPage.xaml.cs
@@ -6,8 +6,12 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.ApplicationModel;
+using Windows.ApplicationModel.DataTransfer;
using Windows.Foundation;
using Windows.Foundation.Collections;
+using Windows.Storage;
+using Windows.Storage.Streams;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@@ -39,6 +43,7 @@ namespace FoxTube.Pages
loading = grid.Children[2] as LoadingPage;
list = ((grid.Children[0] as ScrollViewer).Content as Grid).Children[1] as VideoGrid;
loading.RefreshPage += refresh_Click;
+ DataTransferManager.GetForCurrentView().DataRequested += new TypedEventHandler(Share);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -121,5 +126,48 @@ namespace FoxTube.Pages
{
Initialize(playlistId);
}
+
+ private void share_Click(object sender, RoutedEventArgs e)
+ {
+ DataTransferManager.ShowShareUI();
+ }
+
+ private async void Share(DataTransferManager sender, DataRequestedEventArgs args)
+ {
+ DataRequest request = args.Request;
+ request.Data.Properties.Title = item.Snippet.Title;
+ request.Data.Properties.Description = "Sharing a playlist";
+
+ // Handle errors
+ //request.FailWithDisplayText("Something unexpected could happen.");
+
+ // Plain text
+ request.Data.SetText(item.Snippet.Title + "\n" + "#YouTube #FoxTube #SharedWithFoxTube");
+
+ // Uniform Resource Identifiers (URIs)
+ request.Data.SetWebLink(new Uri($"https://www.youtube.com/playlist?list={item.Id}"));
+
+ // HTML
+ //request.Data.SetHtmlFormat("Bold Text");
+
+ // Because we are making async calls in the DataRequested event handler,
+ // we need to get the deferral first.
+ DataRequestDeferral deferral = request.GetDeferral();
+
+ // Make sure we always call Complete on the deferral.
+ try
+ {
+ StorageFile thumbnailFile = await Package.Current.InstalledLocation.GetFileAsync(item.Snippet.Thumbnails.Medium.Url);
+ request.Data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(thumbnailFile);
+ StorageFile imageFile = await Package.Current.InstalledLocation.GetFileAsync(item.Snippet.Thumbnails.Medium.Url);
+
+ // Bitmaps
+ request.Data.SetBitmap(RandomAccessStreamReference.CreateFromFile(imageFile));
+ }
+ finally
+ {
+ deferral.Complete();
+ }
+ }
}
}