以下是我的项目代码的一部分。它包含一个Timer
,Windows Media Player
等。这个项目确实如此,这里有五个用户给定的时间以及何时达到这个时间到当前时间,然后 WMP 将播放。您能否建议一个代码:在 WMP 中播放时,将所有其他声音静音,只应听到 WMP 的声音。
public void play(string tune)
{
if (label1.Text == label6.Text || label2.Text == label6.Text || label3.Text == label6.Text || label4.Text == label6.Text || label5.Text == label6.Text)
{
axWindowsMediaPlayer1.URL = tune;
if (label6.Text == label1.Text)
{
DialogResult yn = MessageBox.Show("Times to reach pray LUHAR", "Attention Pls:", MessageBoxButtons.OK);
if (yn == DialogResult.OK) { axWindowsMediaPlayer1.Ctlcontrols.stop(); }
}
else if (label6.Text == label2.Text)
{
DialogResult yn = MessageBox.Show("Times to reach pray ASAR", "Attention Pls:", MessageBoxButtons.OK);
if (yn == DialogResult.OK) { axWindowsMediaPlayer1.Ctlcontrols.stop(); }
}
else if (label6.Text == label3.Text)
{
DialogResult yn = MessageBox.Show("Times to reach pray MAGRIB", "Attention Pls:", MessageBoxButtons.OK);
if (yn == DialogResult.OK) { axWindowsMediaPlayer1.Ctlcontrols.stop(); }
}
else if (label6.Text == label4.Text)
{
DialogResult yn = MessageBox.Show("Times to reach pray ISHAH", "Attention Pls:", MessageBoxButtons.OK);
if (yn == DialogResult.OK) { axWindowsMediaPlayer1.Ctlcontrols.stop(); }
}
else if (label6.Text == label5.Text)
{
DialogResult yn = MessageBox.Show("Times to reach pray SUBAH", "Attention Pls:", MessageBoxButtons.OK);
if (yn == DialogResult.OK) { axWindowsMediaPlayer1.Ctlcontrols.stop(); }
}
}
}