void ToggleDevice(object sender, RoutedEventArgs e)
        {
            if (on)
            {
                this.videoSurface.Fill = new SolidColorBrush(Colors.White);
                this.source.Stop();
                this.toggleButton.Content = "Record";
                this.playButton.IsEnabled = true;
                on = false;
            }
            else
            {
                if (CaptureDeviceConfiguration.AllowedDeviceAccess
                    || CaptureDeviceConfiguration.RequestDeviceAccess())
                {
                    this.encoder = new VideoEncoder();
                //C:\hods\Presentations\OfflineWebCam\VideoCapture.Web\VideoCapture.Silverlight\VideoDecoder.cs
                    this.encoder.CaptureSource = this.source;

                    this.source.Start();

                    VideoBrush vidBrush = new VideoBrush();
                    vidBrush.SetSource(this.source);
                    this.videoSurface.Fill = vidBrush;
                    this.toggleButton.Content = "Stop";
                    this.playButton.IsEnabled = false;
                    on = true;
                }
            }
        }
Ejemplo n.º 2
0
        void ToggleDevice(object sender, RoutedEventArgs e)
        {
            if (on)
            {
                this.videoSurface.Fill = new SolidColorBrush(Colors.White);
                this.source.Stop();
                this.toggleButton.Content = "Record";
                this.playButton.IsEnabled = true;
                on = false;
            }
            else
            {
                if (CaptureDeviceConfiguration.AllowedDeviceAccess ||
                    CaptureDeviceConfiguration.RequestDeviceAccess())
                {
                    this.encoder = new VideoEncoder();
                    //C:\hods\Presentations\OfflineWebCam\VideoCapture.Web\VideoCapture.Silverlight\VideoDecoder.cs
                    this.encoder.CaptureSource = this.source;

                    this.source.Start();

                    VideoBrush vidBrush = new VideoBrush();
                    vidBrush.SetSource(this.source);
                    this.videoSurface.Fill    = vidBrush;
                    this.toggleButton.Content = "Stop";
                    this.playButton.IsEnabled = false;
                    on = true;
                }
            }
        }