private void button1_Click(object sender, EventArgs e) { if (_recorder) { timerRecordTime.Stop(); _recorder = false; this.Text = "Recording Stopped."; MainWindowView.StopRecording(); MainWindowView.StopCamera(); // Thread thread = new Thread(showplay); //thread.Start(); VideoPreview videoPreview = new VideoPreview(); videoPreview.Show(); ClosedByCode = true; this.Close(); } else { cmbMicrophone.Enabled = cmbWebCamera.Enabled = false; _recorder = true; //Thread tr= new Thread(startCamera); //tr.Start(); IsRecordLoad = false; timerform timerform = new timerform(); timerform.ShowDialog(); button1.BackgroundImage = Resources.StopRecording2; this.Text = "Recording..."; bool isaudio = waveInCapabilities.Count > 0 ? true : false; MainWindowView.StartRecording(isaudio, cmbMicrophone.SelectedIndex, 2); timerRecordTime.Start(); timerRecordTime.Interval = 1000; } //timerRecordTime.Stop(); //timer1.Start(); }
private void btnStartStop_Click(object sender, EventArgs e) { if (isrecording) { isrecording = false; istopped = true; this.Text = "Recording Stopped."; timer1.Stop(); time = 0; timer1.Dispose(); MainWindowViewModel.StopRecording(); MainWindowViewModel.Dispose(); MainWindowViewModel = null; VideoPreview videoPreview = new VideoPreview(); videoPreview.Show(); closedByCode = true; this.Close(); } else { Thread thread = new Thread(StartRecord); thread.Start(); } }
void ShowPreview() { VideoPreview videoPreview = new VideoPreview(); videoPreview.ShowDialog(); }