public void TogglePlayPauseAudio() { if (audioPlaybackService.PlaybackState == PlaybackState.Stopped) { audioPlaybackService.Play(); } else if (audioPlaybackService.PlaybackState == PlaybackState.Playing) { audioPlaybackService.Pause(); } else if (audioPlaybackService.PlaybackState == PlaybackState.Paused) { audioPlaybackService.Play(); } }
private void AudioRecordingService_PropertyChanged(object sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(AudioRecordingService.CurrentlyRecording): { if (AudioRecordingService.CurrentlyRecording) { if (SettingService.PlayAudioFeedBackMarkingStartAndStopRecording) { audioPlaybackService.KillAudio(reset: true); audioPlaybackService.QueueFile(audioPlaybackService.RecordStartAudioFeedbackPath); audioPlaybackService.Play(); while (audioPlaybackService.PlaybackState != PlaybackState.Stopped) { } audioPlaybackService.KillAudio(reset: true); } if (SettingService.ShowBalloonTipsForRecording) { _notificationManager.ShowAsync( new NotificationContent() { Type = NotificationType.Information, Title = "Recording started!", Message = "RecNForget now recording..." }); } AudioPlaybackService.KillAudio(reset: true); TaskBar_ProgressState = "Error"; } else { if (SettingService.PlayAudioFeedBackMarkingStartAndStopRecording || SettingService.AutoReplayAudioAfterRecording) { if (SettingService.PlayAudioFeedBackMarkingStartAndStopRecording) { actionService.QueueAudioPlayback(fileName: audioPlaybackService.RecordStopAudioFeedbackPath); } if (SettingService.AutoReplayAudioAfterRecording) { actionService.QueueAudioPlayback( fileName: AudioRecordingService.LastFileName, startIndicatorFileName: SettingService.PlayAudioFeedBackMarkingStartAndStopReplaying ? audioPlaybackService.ReplayStartAudioFeedbackPath : null, endIndicatorFileName: SettingService.PlayAudioFeedBackMarkingStartAndStopReplaying ? audioPlaybackService.ReplayStopAudioFeedbackPath : null); } actionService.TogglePlayPauseAudio(); } TaskBar_ProgressState = "None"; if (SettingService.ShowBalloonTipsForRecording) { _notificationManager.ShowAsync( content: new NotificationContent() { Type = NotificationType.Success, Title = "Recording saved!", Message = AudioRecordingService.LastFileName }, onClick: () => { if (AudioRecordingService.LastFileName == string.Empty || !File.Exists(AudioRecordingService.LastFileName)) { return; } string argument = "/select, \"" + AudioRecordingService.LastFileName + "\""; System.Diagnostics.Process.Start("explorer.exe", argument); }); } if (SettingService.AutoSelectLastRecording) { SelectedFileService.SelectFile(new FileInfo(AudioRecordingService.LastFileName)); } } break; } } }