Skip to content

Commit

Permalink
doca: refactor: 按æ�播放/暂停按钮二合一
Browse files Browse the repository at this point in the history
  • Loading branch information
K12f committed Sep 3, 2024
1 parent a8d4c4a commit 8d725db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
9 changes: 2 additions & 7 deletions src/BlueCatKoKo.Ui/ViewModels/Pages/HomeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,13 @@ private async Task Parse()
}

[RelayCommand]
private void PlayVideo()
private void PlayOrPauseVideo()
{
if (!MediaPlayer.IsPlaying)
{
MediaPlayer.Play();
}
}

[RelayCommand]
private void PauseVideo()
{
if (MediaPlayer.IsPlaying)
else
{
MediaPlayer.Pause();
}
Expand Down
5 changes: 2 additions & 3 deletions src/BlueCatKoKo.Ui/Views/Pages/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@
Background="Gainsboro" />
<!-- <CheckBox Margin="0,16,0,0" Content="视频" IsChecked="{Binding ViewModel.IsDownloadVideo}"/> -->
<!-- <CheckBox Margin="0,16,0,0" Content="音频" IsChecked="{Binding ViewModel.IsDownloadAudio}"/> -->
<Button Content="播放视频" Command="{Binding ViewModel.PlayVideoCommand}"
<Button Content="播放/暂停" Command="{Binding ViewModel.PlayOrPauseVideoCommand}"
Style="{StaticResource ButtonPrimary}" />
<Button Content="暂停视频" Command="{Binding ViewModel.PauseVideoCommand}"
Style="{StaticResource ButtonInfo}" />

<Button Content="一键下载" Command="{Binding ViewModel.DownloadAllCommand}"
Style="{StaticResource ButtonSuccess}" />
</hc:UniformSpacingPanel>
Expand Down

0 comments on commit 8d725db

Please sign in to comment.