即使提供了清除按钮,我也无法摆脱声音,在发送声音时,以前的声音仍然存在。有什么不对 ?我需要帮助
string TEMP_FILE=System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\temp";
string BUFF_FILE=System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\data";
private void btnPlayVoice_Click(object sender, EventArgs e)
{
playMedia(BUFF_FILE);
lblRecive.Text = "";
}
private void playMedia(string path )
{if (string.IsNullOrEmpty(path))
return;
mPlayer = new SoundPlayer(BUFF_FILE);
mPlayer.Play();
btnStopStop.Enabled = true;}
private void btnClearDec_Click(object sender, EventArgs e)
{
if (File.Exists(TEMP_FILE))
File.Delete(TEMP_FILE);
if (File.Exists(BUFF_FILE))
File.Delete(BUFF_FILE);
lblRecive.Text = "";
txtKeyDec.Text = "";
txtMsgDec.Text = "";
btnPlay.Visible = false;
btnDec.Visible = false;
}
多次发送语音消息时,第一个声音无法删除,因此在发送下一条消息时仍会听到。如果代码不清楚,那么我可以给这个项目,也许我会找到一个解决方案