private void start_Click(object sender, EventArgs e)
 {
     AudioCheckBox.Enabled = false;
     RecordButton.Enabled = false;
     FinishButton.Enabled = true;
     goRecorder = new GoVideoRecorder();
     RecordingStart = DateTime.UtcNow;
     timeLabel.Text = "Starting...";
     frameCounter = 0;
     capturer.Release(oldPixels);
     oldPixels = Pixels.Null;
     if (AudioCheckBox.Checked)
     {
         audioRecorder = new Recorder(0.3f);
         audioRecorder.Paused = false;
     }
 }
 private void FinishButton_Click(object sender, EventArgs e)
 {
     //Fixme: Check Error handling
     bool wasPaused = false;
     if (audioRecorder != null)
     {
         wasPaused = audioRecorder.Paused;
         audioRecorder.Paused = true;
     }
     if (audioRecorder != null)
     {
         using (SaveFileDialog dlg = new SaveFileDialog())
         {
             dlg.DefaultExt = ".GoLesson";
             dlg.Filter = "Go Audio Lesson|*.GoLesson|All Files|*.*";
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 string replay = goRecorder.Replay.Save();
                 audioRecorder.Finish();
                 Stream audio = audioRecorder.Data;
                 audio.Position = 0;
                 AudioLessonFile.Save(dlg.FileName, replay, audio);
                 FinishButton.Enabled = false;
                 goRecorder = null;
                 audioRecorder = null;
             }
         }
     }
     else
     {
         using (SaveFileDialog dlg = new SaveFileDialog())
         {
             dlg.DefaultExt = ".GoReplay";
             dlg.Filter = "Go Replay|*.GoReplay|All Files|*.*";
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 goRecorder.Replay.Save(dlg.FileName);
                 FinishButton.Enabled = false;
                 goRecorder = null;
             }
         }
     }
     if (audioRecorder != null)
         audioRecorder.Paused = wasPaused;
 }
 public void AddAudio()
 {
     if (!CanAddAudio)
         throw new InvalidOperationException();
     Media = new Recorder(0.3f);
 }