private ContentControl cc = null;

private void muiscPlay(object sender, RoutedEventArgs e)
{
string name = ((ContentControl)sender).Tag.ToString();
if (string.IsNullOrWhiteSpace(name))
return;
if (filename != name)
{
player.Stop();
isStart = true;
if (cc != null)
cc.SetResourceReference(System.Windows.Controls.Button.StyleProperty, "playButtonStyle2");
player.LoadedBehavior = MediaState.Manual;
player.Source = new Uri("./Resource/musics/" + name, UriKind.Relative);
filename = name;
}
if (isStart)
{
player.Play();
((ContentControl)sender).SetResourceReference(System.Windows.Controls.Button.StyleProperty, "pauseButtonStyle2");
cc = ((ContentControl)sender);
isStart = false;
}
else
{
player.Pause();
((ContentControl)sender).SetResourceReference(System.Windows.Controls.Button.StyleProperty, "playButtonStyle2");
isStart = true;
}
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2020-03-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
相关资源
相似解决方案