public void StartCaptureButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         WebcamViewer.StartPreview();
     }
     catch (Microsoft.Expression.Encoder.SystemErrorException ex)
     {
         MessageBox.Show("Device is in use by another application");
     }
 }
예제 #2
0
 private void StartCapture()
 {
     try
     {
         // Display webcam video
         WebcamViewer.StartPreview();
     }
     catch (Microsoft.Expression.Encoder.SystemErrorException ex)
     {
         MessageBox.Show("Device is in use by another application");
     }
 }
예제 #3
0
        private async void WebcamViewer_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (waiting)
            {
                return;
            }
            waiting = true;
            WebcamViewer.StopPreview();
            await Task.Delay(100);

            WebcamViewer.StartPreview();
            waiting = false;
        }
예제 #4
0
 private void StartCaptureButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         // Display webcam video
         WebcamViewer.StartPreview();
         TakePhotoBtn.IsEnabled  = true;
         StopCameraBtn.IsEnabled = true;
     }
     catch (Microsoft.Expression.Encoder.SystemErrorException ex)
     {
         CustomizeDialog dialog = new CustomizeDialog("カメラが他のアプリケーションに利用されています!");
         dialog.ShowDialog();
     }
 }
예제 #5
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (!initialized)
            {
                initialized = true;

                var cam = EncoderDevices.FindDevices(EncoderDeviceType.Video).Last();
                WebcamViewer.VideoDevice    = cam;
                WebcamViewer.ImageDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "VideoCaptures");
                WebcamViewer.StartPreview();

                DetailsList.ItemsSource = Images;
                VolumeSlider.Value      = DEFAULT_VOLUME * 100;

                _songController.BarStarted += Controller_BarStarted;
            }
        }
예제 #6
0
        public MainWindow()
        {
            InitializeComponent();

            this.DataContext = this;

            window1         = new Window1();
            window1.Closed += (s, e) => this.Close();
            window1.Show();

            this.Closed += (s, e) => window1.Close();

            rect.ContextMenu = new ContextMenu();

            rect.ContextMenu.Opened += (s, e) =>
            {
                var VideoDevices = EncoderDevices.FindDevices(EncoderDeviceType.Video);

                rect.ContextMenu.Items.Clear();

                foreach (var device in VideoDevices)
                {
                    var menuItem = new MenuItem
                    {
                        Header = device.Name
                    };
                    menuItem.Click += (s1, e1) =>
                    {
                        WebcamViewer.VideoDevice = device;
                        try
                        {
                            WebcamViewer.StartPreview();
                        }
                        catch (Microsoft.Expression.Encoder.SystemErrorException ex)
                        {
                            MessageBox.Show("Device is in use by another application");
                        }
                    };
                    rect.ContextMenu.Items.Add(menuItem);
                }
            };
        }
예제 #7
0
 public void startStreaming()
 {
     Session.dataRecorder.startStreaming();
     WebcamViewer.StartPreview();
     Streaming();
 }