/// <summary> /// Starts recording or calls "ResumeVoiceRecording" method if it was paused. /// Invokes "VoiceRecorderStarted" if the recording was started. /// </summary> public void StartVoiceRecording() { if (_recorder.State == RecorderState.Paused) { ResumeVoiceRecording(); return; } try { CreateDirectory(); _recordingPath = string.Format(PATH_TEMPLATE_TO_RECORDINGS, DateTime.Now.ToString("yyMMdd-HHmmss"), "." + _recorder.FileFormat.ToString().ToLower()); _recorder.Start(_recordingPath); } catch (Exception exception) { ErrorHandler(exception.Message); return; } VoiceRecorderStarted?.Invoke(this, _recordingPath); }
/// <summary> /// Handles "VoiceRecorderStarted" of the IVoiceRecorderService object. /// Invokes "VoiceRecorderStarted" to other application's modules. /// </summary> /// <param name="sender">Instance of the VoiceRecorderService class.</param> /// <param name="currentRecordingPath">Path to the sample which is being recorded at the moment.</param> private void VoiceRecorderStartedEventHandler(object sender, string currentRecordingPath) { VoiceRecorderStarted?.Invoke(this, currentRecordingPath); }