Items cards' context menu. Fixed duplicating authors' name on comments replies. Another version of logo
Related Work Items: #226
This commit is contained in:
@@ -52,4 +52,12 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Button>
|
||||
<UserControl.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem Icon="Contact" Text="View channel" Click="Button_Click"/>
|
||||
<MenuFlyoutSeparator/>
|
||||
<MenuFlyoutItem Icon="Link" Text="Copy link" Name="getLink" Click="GetLink_Click"/>
|
||||
<MenuFlyoutItem Icon="Share" Text="Share" Name="share" Click="Share_Click"/>
|
||||
</MenuFlyout>
|
||||
</UserControl.ContextFlyout>
|
||||
</UserControl>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Channel item card
|
||||
/// </summary>
|
||||
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<DataTransferManager, DataRequestedEventArgs>(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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)); }
|
||||
|
||||
@@ -48,4 +48,13 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Button>
|
||||
<UserControl.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem Icon="List" Text="View playlist" Click="Button_Click"/>
|
||||
<MenuFlyoutItem Icon="Contact" Text="View channel" Name="openChannel" Click="OpenChannel_Click"/>
|
||||
<MenuFlyoutSeparator/>
|
||||
<MenuFlyoutItem Icon="Link" Text="Copy link" Name="getLink" Click="GetLink_Click"/>
|
||||
<MenuFlyoutItem Icon="Share" Text="Share" Name="share" Click="Share_Click"/>
|
||||
</MenuFlyout>
|
||||
</UserControl.ContextFlyout>
|
||||
</Page>
|
||||
|
||||
@@ -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<DataTransferManager, DataRequestedEventArgs>(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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,13 +53,18 @@
|
||||
</Button>
|
||||
<UserControl.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem Icon="Play" Text="Play"/>
|
||||
<MenuFlyoutItem Icon="Contact" Text="View channel"/>
|
||||
<MenuFlyoutItem Icon="Play" Text="Play" Name="play" Click="Button_Click"/>
|
||||
<MenuFlyoutItem Text="Play incognito" Visibility="Collapsed">
|
||||
<MenuFlyoutItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</MenuFlyoutItem.Icon>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutItem Icon="Contact" Text="View channel" Name="viewChannel" Click="ViewChannel_Click"/>
|
||||
<MenuFlyoutSeparator/>
|
||||
<MenuFlyoutItem Icon="Link" Text="Copy link"/>
|
||||
<MenuFlyoutItem Icon="Share" Text="Share"/>
|
||||
<MenuFlyoutSeparator/>
|
||||
<MenuFlyoutItem Icon="Download" Text="Download"/>
|
||||
<MenuFlyoutItem Icon="Link" Text="Copy link" Name="getLink" Click="GetLink_Click"/>
|
||||
<MenuFlyoutItem Icon="Share" Text="Share" Name="share" Click="Share_Click"/>
|
||||
<MenuFlyoutSeparator Visibility="Collapsed"/>
|
||||
<MenuFlyoutItem Icon="Download" Text="Download" Visibility="Collapsed"/>
|
||||
</MenuFlyout>
|
||||
</UserControl.ContextFlyout>
|
||||
</UserControl>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Video item card
|
||||
/// </summary>
|
||||
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<DataTransferManager, DataRequestedEventArgs>(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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user