public void PlayVoice(string fileName, IntPtr handle) { if (recordVoice == null) { recordVoice = new RecordVoice(); } recordVoice.PlayVoice(fileName, handle); }
private void toolRecordVoice_Click(object sender, EventArgs e) { if (!labRecordVoice.Visible) { toolRecordVoice.Image = Resource1.录音中; labRecordVoice.Visible = true; toolCancelRecordVoice.Visible = true; toolRecordVoice.ToolTipText = "点击结束录音并上传"; Application.DoEvents(); if (recordVoice == null) { recordVoice = new RecordVoice(); } recordVoice.BeginRecord2(); //if (audioRecorder == null) //{ // audioRecorder = new AudioRecorder(); //} //audioRecorder.StartRecording(saveAudioFile); } else { toolRecordVoice.Image = Resource1.录音; labRecordVoice.Visible = false; toolCancelRecordVoice.Visible = false; toolRecordVoice.ToolTipText = "点击开始录音"; Application.DoEvents(); // ((ToolTipItem)btnRecordAudio.SuperTip.Items[0]).Text = "点击按钮开始录音"; string saveFile = recordVoice.StopRecord2(); // audioRecorder.EndRecord(); Thread.Sleep(500); UploadFileToALL(saveFile, false); } }