@@ -1,4 +1,5 @@
|
||||
using Google.Apis.YouTube.v3;
|
||||
using FoxTube.Pages;
|
||||
using Google.Apis.YouTube.v3;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -16,11 +17,14 @@ using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Documents;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using YoutubeExplode.Models.MediaStreams;
|
||||
|
||||
namespace FoxTube
|
||||
{
|
||||
public static class Methods
|
||||
{
|
||||
public static CommentsPage CommentsPage { get; set; }
|
||||
|
||||
public static bool NeedToResponse { get; set; } = false;
|
||||
public static MainPage MainPage
|
||||
{
|
||||
@@ -139,6 +143,37 @@ namespace FoxTube
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetVideoQualityLabel(this VideoQuality quality)
|
||||
{
|
||||
switch (quality)
|
||||
{
|
||||
case VideoQuality.High1080:
|
||||
return "1080p";
|
||||
case VideoQuality.High1440:
|
||||
return "1440p";
|
||||
case VideoQuality.High2160:
|
||||
return "2160p";
|
||||
case VideoQuality.High2880:
|
||||
return "2880p";
|
||||
case VideoQuality.High3072:
|
||||
return "3072p";
|
||||
case VideoQuality.High4320:
|
||||
return "4320p";
|
||||
case VideoQuality.High720:
|
||||
return "720p";
|
||||
case VideoQuality.Low144:
|
||||
return "144p";
|
||||
case VideoQuality.Low240:
|
||||
return "240p";
|
||||
case VideoQuality.Medium360:
|
||||
return "360p";
|
||||
case VideoQuality.Medium480:
|
||||
return "480p";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/*public static string QualityToString(YouTubeQuality quality)
|
||||
{
|
||||
switch(quality)
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
x:Class="FoxTube.Controls.CommentCard"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:FoxTube.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="400">
|
||||
|
||||
@@ -38,8 +36,9 @@
|
||||
<StackPanel Grid.Row="2" Name="editor" Visibility="Collapsed">
|
||||
<TextBox Name="editorText" Text="[Content]" AcceptsReturn="True" TextWrapping="Wrap" TextChanged="editorText_TextChanged"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,0,5">
|
||||
<Button Name="editorClose" Content="Cancel" Click="editorClose_Click"/>
|
||||
<Button Name="editorSend" Content="Submit" Margin="5,0,0,0" Click="editorSend_Click"/>
|
||||
<Button Content="Delete comment" Background="Red" Name="deleteComment" Click="DeleteComment_Click"/>
|
||||
<Button Name="editorClose" Content="Cancel" Click="editorClose_Click" Margin="5, 0"/>
|
||||
<Button Name="editorSend" Content="Submit" Click="editorSend_Click"/>
|
||||
</StackPanel>
|
||||
<ProgressBar Name="editorSending" Foreground="Red" IsIndeterminate="True" Visibility="Collapsed"/>
|
||||
</StackPanel>
|
||||
|
||||
@@ -274,5 +274,26 @@ namespace FoxTube.Controls
|
||||
editorText.Text = text.Text;
|
||||
editor.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private async void DeleteComment_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageDialog dialog = new MessageDialog("Are you sure? This action cannot be undone", "Delete comment");
|
||||
|
||||
dialog.Commands.Add(new UICommand("Yes", async (command) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await SecretsVault.Service.Comments.Delete(item.Id).ExecuteAsync();
|
||||
Methods.CommentsPage.RemoveComment(this);
|
||||
}
|
||||
catch { }
|
||||
}));
|
||||
dialog.Commands.Add(new UICommand("No"));
|
||||
|
||||
dialog.CancelCommandIndex = 1;
|
||||
dialog.DefaultCommandIndex = 0;
|
||||
|
||||
await dialog.ShowAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
using Google.Apis.YouTube.v3;
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using FoxTube.Controls;
|
||||
using Windows.UI.Popups;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace FoxTube.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// Comments placeholder
|
||||
/// </summary>
|
||||
public sealed partial class CommentsPage : Page
|
||||
{
|
||||
@@ -29,6 +26,7 @@ namespace FoxTube.Pages
|
||||
public async void Initialize(Video video)
|
||||
{
|
||||
threadId = video.Id;
|
||||
Methods.CommentsPage = this;
|
||||
|
||||
if (!SecretsVault.IsAuthorized)
|
||||
grid.RowDefinitions[0].Height = new GridLength(0);
|
||||
@@ -53,6 +51,11 @@ namespace FoxTube.Pages
|
||||
placeholder.Children.Add(new CommentCard(comment));
|
||||
}
|
||||
|
||||
public void RemoveComment(CommentCard commentCard)
|
||||
{
|
||||
placeholder.Children.Remove(commentCard);
|
||||
}
|
||||
|
||||
private async void more_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
more.Visibility = Visibility.Collapsed;
|
||||
|
||||
@@ -444,7 +444,8 @@ namespace FoxTube
|
||||
else
|
||||
{
|
||||
nav.CompactModeThresholdWidth = 641;
|
||||
nav.ExpandedModeThresholdWidth = 1008;
|
||||
if(videoPlaceholder.Content == null)
|
||||
nav.ExpandedModeThresholdWidth = 1008;
|
||||
nav.Margin = new Thickness(0);
|
||||
if (videoPlaceholder.Content != null && nav.IsPaneOpen)
|
||||
nav.IsPaneOpen = false;
|
||||
|
||||
Reference in New Issue
Block a user