Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
添加播放/暂停按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiichiamane committed May 21, 2019
1 parent 2e3339a commit ca9b4eb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions PixivFSUWP/IllustDetailPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@
<TextBlock x:Name="txtAuthorAccount" Margin="10,0" Grid.Row="1" Grid.Column="1" FontSize="14" Foreground="Gray" VerticalAlignment="Top"/>
</Grid>
</Button>
<Button Style="{StaticResource ButtonRevealStyle}" x:Name="btnPlay" Click="BtnPlay_Click"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Width="70" Visibility="Collapsed">
<StackPanel Margin="5">
<FontIcon x:Name="iconPlay" FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="20" Glyph="&#xE769;"/>
<TextBlock x:Name="txtPlay" Margin="0,5,0,0">暂停</TextBlock>
</StackPanel>
</Button>
<Button Style="{StaticResource ButtonRevealStyle}"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Width="70">
Expand Down
19 changes: 19 additions & 0 deletions PixivFSUWP/IllustDetailPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public sealed partial class IllustDetailPage : Page

bool _emergencyStop = false;
bool _busy = false;
bool _playing = true;

public IllustDetailPage()
{
Expand Down Expand Up @@ -134,6 +135,8 @@ private async Task loadContent()
{
ugoiraPlayer.Visibility = Visibility.Visible;
ImageList.Visibility = Visibility.Collapsed;
btnPlay.IsEnabled = false;
btnPlay.Visibility = Visibility.Visible;
txtLoadingStatus.Text = "正在加载动态剪影";
if (_emergencyStop)
{
Expand All @@ -142,6 +145,7 @@ private async Task loadContent()
ugoira = await Data.UgoiraHelper.GetUgoiraAsync(illust.IllustID.ToString());
_ = playUgoira();
txtLoadingStatus.Text = "正在播放动态剪影";
btnPlay.IsEnabled = true;
}
else
{
Expand Down Expand Up @@ -358,5 +362,20 @@ private void Button_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(UserDetailPage), illust.AuthorID);
}

private void BtnPlay_Click(object sender, RoutedEventArgs e)
{
if (_playing)
{
txtPlay.Text = "继续";
iconPlay.Glyph = "";
}
else
{
txtPlay.Text = "暂停";
iconPlay.Glyph = "";
}
_playing = !_playing;
}
}
}

0 comments on commit ca9b4eb

Please sign in to comment.