void RecordClicked(object sender, RoutedEventArgs e)
        {
            this.stopButton.IsEnabled   = true;
            this.recordButton.IsEnabled = false;
            this.playButton.IsEnabled   = false;
            this.waveDisplay.ResetSelection();


            this.source = new CaptureSource();
            this.source.AudioCaptureDevice =
                CaptureDeviceConfiguration.GetDefaultAudioCaptureDevice();

            this.source.AudioCaptureDevice.DesiredFormat =
                ((SupportedFormat)this.formatList.SelectedItem).Format;
            this.encoder = new AudioEncoder();
            this.timer.Start();
            this.progressPanel.Visibility = Visibility.Visible;
            this.encoder.EncoderIsFull   += ((s, args) =>
            {
                Dispatcher.BeginInvoke(() =>
                {
                    this.Stop();
                });
            });
            this.encoder.CaptureSource = this.source;

            if (CaptureDeviceConfiguration.AllowedDeviceAccess ||
                CaptureDeviceConfiguration.RequestDeviceAccess())
            {
                this.source.Start();
                this.recording            = true;
                this.playButton.IsEnabled = false;
                this.formatList.IsEnabled = false;
                this.deviceList.IsEnabled = false;
            }
        }
        void RecordClicked(object sender, RoutedEventArgs e)
        {
            this.stopButton.IsEnabled = true;
            this.recordButton.IsEnabled = false;
            this.playButton.IsEnabled = false;
            this.waveDisplay.ResetSelection();
            this.source = new CaptureSource();
            this.source.AudioCaptureDevice =
                CaptureDeviceConfiguration.GetDefaultAudioCaptureDevice();
            this.source.AudioCaptureDevice.DesiredFormat =
                ((SupportedFormat)this.formatList.SelectedItem).Format;
            this.encoder = new AudioEncoder();
            this.timer.Start();
            this.progressPanel.Visibility = Visibility.Visible;
            this.encoder.EncoderIsFull += ((s, args) =>
                {
                    Dispatcher.BeginInvoke(() =>
                    {
                        this.Stop();
                    });
                });
            this.encoder.CaptureSource = this.source;

            if (CaptureDeviceConfiguration.AllowedDeviceAccess
                || CaptureDeviceConfiguration.RequestDeviceAccess())
            {
                this.source.Start();
                this.recording = true;
                this.playButton.IsEnabled = false;
                this.formatList.IsEnabled = false;
                this.deviceList.IsEnabled = false;
            }
        }