//重置音频窗口的图标 public void changeVolumeStatus(bool volumeStatus) { try { if (this.audioPlayedStatus != volumeStatus) { logger.Info("修改窗口[" + _index + "]上的音频状态为:" + volumeStatus); } this.audioPlayedStatus = volumeStatus; if (volumeStatus) { //PlayerSdk.EasyPlayer_StopSound(); //Thread.Sleep(500); logger.Info("播放音频:" + channelId); int ret = PlayerSdk.EasyPlayer_PlaySound(channelId); logger.Info("播放音频状态:" + ret); volumeSwitch.BackgroundImage = Properties.Resources.redioOpen; } else { PlayerSdk.EasyPlayer_StopSound(); volumeSwitch.BackgroundImage = Properties.Resources.redioClose; } } catch (Exception e) { logger.Error("", e); } }
/// <summary> /// 播放音频 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PlaySound_MenuItem_Click(object sender, EventArgs e) { if (channelID <= 0) { return; } var checkState = (sender as ToolStripMenuItem).CheckState; if (checkState == CheckState.Unchecked) { int ret = PlayerSdk.EasyPlayer_PlaySound(channelID); (sender as ToolStripMenuItem).CheckState = CheckState.Checked; } if (checkState == CheckState.Checked) { int ret = PlayerSdk.EasyPlayer_StopSound(); (sender as ToolStripMenuItem).CheckState = CheckState.Unchecked; } }