private void btnStop_Click(object sender, EventArgs e) { btnStop.Text = "Stop"; if (bRecording && !bPlaying) { plmidi.stopRecording(); btnPlay.Enabled = btnDetails.Enabled = btnRecord.Enabled = btnRemove.Enabled = true; btnStop.Enabled = false; refreshLoadMidi(); bRecording = false; } else if (bPlaying && !bRecording) { plmidi.stopPlaying(); btnPlay.Enabled = btnDetails.Enabled = btnRecord.Enabled = btnRemove.Enabled = true; btnStop.Enabled = false; bPlaying = false; } else { throw new Exception("Not executed."); } }