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