private void OnRecordUp(object sender, MouseEventArgs e) { if (!_recorder.IsRecording) { return; } try { _recorder.StopRecordingAndSaveAsWav(); } catch (Exception) { //swallow it review: initial reason is that they didn't hold it down long enough, could detect and give message } if (_recorder.LastRecordingMilliseconds < 500) { if (File.Exists(_path)) { File.Delete(_path); } _hint.Text = "Hold down the record button while talking."; } else { _hint.Text = ""; } UpdateScreen(); if (SoundRecorded != null) { SoundRecorded.Invoke(this, null); UsageReporter.SendNavigationNotice("AudioRecorded"); } }
private void OnRecordDown(object sender, MouseEventArgs e) { if (ModifierKeys == Keys.Shift) { if (LetUserSelectPrerecordedFile() && SoundRecorded != null) { SoundRecorded.Invoke(this, null); } return; } //allow owner one last chance to set a path (which may be sensitive to other ui controls) if (BeforeStartingToRecord != null) { BeforeStartingToRecord.Invoke(this, null); } if (File.Exists(Path)) { File.Delete(Path); } try { _recorder.StartRecording(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Sound Problem"); } UpdateScreen(); }