Ejemplo n.º 1
0
        /// <summary>
        /// Button, which stops recording
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_stopRecording_Click(object sender, RoutedEventArgs e)
        {
            if (rec != null)
            {
                rec.DisposeAll();
                rec = null;
            }

            // Disable and enable button
            btn_recordingStart.IsEnabled = true;
            btn_stopRecording.IsEnabled = false;

            lb_recordingStatus.Content = "Not Recording";
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Button, which starts recording
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_recordingStart_Click(object sender, RoutedEventArgs e)
        {
            // Check if no folder is selected
            if (String.IsNullOrEmpty(Folder))
            {
                MessageBox.Show("No Output-Folder selected. Please select one.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            // Check of folder exists
            if (!Directory.Exists(Folder))
            {
                MessageBox.Show("The Output-Folder you selected does not exist.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            // Check if recording device is selected
            if (cb_recordingDevices.SelectedIndex.Equals(-1))
            {
                MessageBox.Show("No recording device selected!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            try
            {
                rec = new SpotRecorder(Folder, filters.AudioInputDevices[cb_recordingDevices.SelectedIndex]);
                rec.TrackRecorded += new SpotRecorder.TrackRecordedEventHandler(rec_TrackRecorded);
                rec.spotHandler.TrackChanged += new LibSpot.Handlers.SpotHandlerBase.TrackChangedEventHandler(spotHandler_TrackChanged);
                lb_recordingStatus.Content = "Recording...";

                // Disable and enable buttons
                btn_stopRecording.IsEnabled = true;
                btn_recordingStart.IsEnabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }