예제 #1
0
 private void StartCaptureButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         // Display webcam video
         WebcamCtrl.StartPreview();
     }
     catch (Microsoft.Expression.Encoder.SystemErrorException ex)
     {
         MessageBox.Show("Device is in use by another application");
     }
 }
예제 #2
0
 private void StartCaptureButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         // Display webcam video
         WebcamCtrl.StartPreview();
     }
     catch
     {
         MessageBox.Show("Device is in use by another application");
     }
 }
 private void button_Copy1_Click(object sender, RoutedEventArgs e)
 {
     if (!connected)
     {
         WebcamCtrl.StartPreview();
         button_Copy1.Content = "Disconnect";
     }
     else
     {
         WebcamCtrl.StopRecording();
         button_Copy1.Content = "Connect";
     }
 }
        public Take_Photo()
        {
            InitializeComponent();
            Loger.WriteLog(this.GetType() + "- InitializeComponent");


            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += timer_Tick;
            timer.Start();
            // Find available a/v devices
            vida = EncoderDevices.FindDevices(EncoderDeviceType.Video);

            Binding binding_1 = new Binding("SelectedValue");

            binding_1.Source = VideoDevicesComboBox;
            WebcamCtrl.SetBinding(Webcam.VideoDeviceProperty, binding_1);
            // Create directory for saving image files
            string imagePath = @"WebcamSnapshots";

            if (!Directory.Exists(imagePath))
            {
                Directory.CreateDirectory(imagePath);
            }

            //// Set some properties of the Webcam control
            WebcamCtrl.ImageDirectory          = imagePath;
            VideoDevicesComboBox.ItemsSource   = vida;;
            VideoDevicesComboBox.SelectedIndex = 0;

            //start the preview
            try
            {
                // Display webcam video
                WebcamCtrl.StartPreview();
            }
            catch (Microsoft.Expression.Encoder.SystemErrorException ex)
            {
                Helper.ShowPopUp("Device is in use by another application", "Device Busy");
                Loger.WriteLog(this.GetType() + "-Exception:" + ex.Message + Environment.NewLine + "StackTrace:" + ex.StackTrace);
            }
        }
예제 #5
0
        private void startCapturing()
        {
            try
            {
                // Display webcam video
                WebcamCtrl.StartPreview();
            }
            catch (Microsoft.Expression.Encoder.SystemErrorException ex)
            {
                MessageBox.Show("Device is in use by another application");
            }

            m_timer          = new System.Windows.Forms.Timer();
            m_timer.Tick    += new EventHandler(Timer_handle);
            m_timer.Interval = kInterval;
            m_timer.Start();

            m_timer2       = new System.Windows.Forms.Timer();
            m_timer2.Tick += (s, e) =>
            {
                if (m_player == null)
                {
                    return;
                }
                IWMPControls controls = m_player.controls;
                if (controls == null || controls.currentItem == null)
                {
                    return;
                }

                double pos      = controls.currentPosition;
                double duration = controls.currentItem.duration;
                if (duration > 0.1)
                {
                    TheSlider.Value = pos / duration;
                }
            };
            m_timer2.Interval = 400;
            m_timer2.Start();
        }