private void btnPlayPause_Click(object sender, RoutedEventArgs e) { if (isRecording) { StopRecording(); isPlaying = false; } else { isPlaying = !isPlaying; if (isPlaying) { StartPlayback(); } else { StopPlayback(); } } UpdateButtonStates(); }