#152, 179, 177
This commit is contained in:
@@ -13,8 +13,7 @@
|
||||
RequestedTheme="Dark"
|
||||
PointerMoved="UserControl_PointerMoved"
|
||||
PointerExited="UserControl_PointerExited"
|
||||
PointerEntered="UserControl_PointerEntered"
|
||||
KeyUp="UserControl_KeyUp">
|
||||
PointerEntered="UserControl_PointerEntered">
|
||||
|
||||
<Grid Background="White" Name="grid" Tapped="UserControl_Tapped">
|
||||
<MediaElement IsDoubleTapEnabled="False" CurrentStateChanged="videoSource_CurrentStateChanged" AutoPlay="False" Name="videoSource" AreTransportControlsEnabled="False" PosterSource="ms-appx:///Assets/videoThumbSample.png"/>
|
||||
|
||||
@@ -93,6 +93,12 @@ namespace FoxTube
|
||||
volume.Value = Convert.ToDouble(settings.Values["volume"]);
|
||||
videoSource.AutoPlay = (bool)settings.Values["videoAutoplay"];
|
||||
|
||||
videoSource.MediaEnded += (s, arg) =>
|
||||
{
|
||||
seek.Value = seek.Maximum;
|
||||
seekIndicator.Value = seekIndicator.Maximum;
|
||||
seekTimer.Stop();
|
||||
};
|
||||
t.Elapsed += T_Elapsed;
|
||||
seekTimer.Elapsed += SeekTimer_Elapsed;
|
||||
}
|
||||
@@ -445,6 +451,8 @@ namespace FoxTube
|
||||
play.IsEnabled = true;
|
||||
touchPlay.IsEnabled = true;
|
||||
|
||||
seekTimer.Start();
|
||||
|
||||
play.Content = "\xE103";
|
||||
touchPlay.Content = "\xE103";
|
||||
|
||||
@@ -671,7 +679,7 @@ namespace FoxTube
|
||||
play_Click(this, null);
|
||||
}
|
||||
|
||||
private void UserControl_KeyUp(object sender, KeyRoutedEventArgs e)
|
||||
public void KeyUpPressed(object sender, KeyRoutedEventArgs e)
|
||||
{
|
||||
switch(e.Key)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
|
||||
xmlns:pages="using:FoxTube.Pages"
|
||||
mc:Ignorable="d"
|
||||
SizeChanged="Page_SizeChanged">
|
||||
SizeChanged="Page_SizeChanged"
|
||||
PreviewKeyUp="Page_PreviewKeyUp">
|
||||
|
||||
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
|
||||
@@ -655,5 +655,14 @@ namespace FoxTube
|
||||
else
|
||||
content.GoBack();
|
||||
}
|
||||
|
||||
private void Page_PreviewKeyUp(object sender, KeyRoutedEventArgs e)
|
||||
{
|
||||
if(videoPlaceholder.Content != null)
|
||||
{
|
||||
e.Handled = true;
|
||||
(videoPlaceholder.Content as VideoPage).player.KeyUpPressed(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ namespace FoxTube.Pages
|
||||
|
||||
dislike.Foreground = new SolidColorBrush(Colors.Red);
|
||||
dislikes.Text = (int.Parse(dislikes.Text, System.Globalization.NumberStyles.AllowThousands) + 1).ToString("0,0");
|
||||
rating.Value = (int)((item.Statistics.LikeCount - 1) / (item.Statistics.DislikeCount + item.Statistics.LikeCount) * 100);
|
||||
rating.Value--;
|
||||
await SecretsVault.Service.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.Dislike).ExecuteAsync();
|
||||
|
||||
userRating = Rating.Dislike;
|
||||
@@ -459,7 +459,7 @@ namespace FoxTube.Pages
|
||||
case Rating.None:
|
||||
dislike.Foreground = new SolidColorBrush(Colors.Red);
|
||||
dislikes.Text = (int.Parse(dislikes.Text, System.Globalization.NumberStyles.AllowThousands) + 1).ToString("0,0");
|
||||
rating.Value = (int)((item.Statistics.LikeCount) / (item.Statistics.DislikeCount + item.Statistics.LikeCount + 1) * 100);
|
||||
rating.Maximum++;
|
||||
await SecretsVault.Service.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.Dislike).ExecuteAsync();
|
||||
|
||||
userRating = Rating.Dislike;
|
||||
@@ -468,7 +468,7 @@ namespace FoxTube.Pages
|
||||
case Rating.Dislike:
|
||||
dislike.Foreground = new SolidColorBrush(Colors.Gray);
|
||||
dislikes.Text = (int.Parse(dislikes.Text, System.Globalization.NumberStyles.AllowThousands) - 1).ToString("0,0");
|
||||
rating.Value = (int)((item.Statistics.LikeCount) / (item.Statistics.DislikeCount + item.Statistics.LikeCount - 1) * 100);
|
||||
rating.Maximum--;
|
||||
await SecretsVault.Service.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.None).ExecuteAsync();
|
||||
break;
|
||||
}
|
||||
@@ -485,7 +485,7 @@ namespace FoxTube.Pages
|
||||
|
||||
like.Foreground = new SolidColorBrush(Colors.Green);
|
||||
likes.Text = (int.Parse(likes.Text, System.Globalization.NumberStyles.AllowThousands) + 1).ToString("0,0");
|
||||
rating.Value = (int)((item.Statistics.LikeCount + 1) / (item.Statistics.DislikeCount + item.Statistics.LikeCount) * 100);
|
||||
rating.Value++;
|
||||
await SecretsVault.Service.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.Like).ExecuteAsync();
|
||||
|
||||
userRating = Rating.Like;
|
||||
@@ -494,7 +494,8 @@ namespace FoxTube.Pages
|
||||
case Rating.None:
|
||||
like.Foreground = new SolidColorBrush(Colors.Green);
|
||||
likes.Text = (int.Parse(likes.Text, System.Globalization.NumberStyles.AllowThousands) + 1).ToString("0,0");
|
||||
rating.Value = (int)((item.Statistics.LikeCount + 1) / (item.Statistics.DislikeCount + item.Statistics.LikeCount + 1) * 100);
|
||||
rating.Maximum++;
|
||||
rating.Value++;
|
||||
await SecretsVault.Service.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.Like).ExecuteAsync();
|
||||
|
||||
userRating = Rating.Like;
|
||||
@@ -503,7 +504,8 @@ namespace FoxTube.Pages
|
||||
case Rating.Like:
|
||||
like.Foreground = new SolidColorBrush(Colors.Gray);
|
||||
likes.Text = (int.Parse(likes.Text, System.Globalization.NumberStyles.AllowThousands) - 1).ToString("0,0");
|
||||
rating.Value = (int)((item.Statistics.LikeCount - 1) / (item.Statistics.DislikeCount + item.Statistics.LikeCount - 1) * 100);
|
||||
rating.Maximum--;
|
||||
rating.Value--;
|
||||
await SecretsVault.Service.Videos.Rate(videoId, VideosResource.RateRequest.RatingEnum.None).ExecuteAsync();
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user