예제 #1
0
 private void RecordButton_Click(object sender, RoutedEventArgs e)
 {
     if (Directory.Exists(MainWindow.MWInstance.videoDir))
     {
         WebCamCtrl.VideoDirectory = MainWindow.MWInstance.videoDir;
         WebCamCtrl.StartRecording();
     }
 }
예제 #2
0
 private void SnapshotButton_Click(object sender, RoutedEventArgs e)
 {
     if (Directory.Exists(MainWindow.MWInstance.imageDir))
     {
         WebCamCtrl.ImageDirectory = MainWindow.MWInstance.imageDir;
         WebCamCtrl.TakeSnapshot();
     }
 }
예제 #3
0
 private void camStartButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         WebCamCtrl.StartCapture();
     }
     catch (Microsoft.Expression.Encoder.SystemErrorException)
     {
         MessageBox.Show("Device is in use by another application");
     }
 }
예제 #4
0
 private void StartButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         // Display webcam video on control.
         WebCamCtrl.FrameSize = new System.Drawing.Size(450, 310);
         WebCamCtrl.StartCapture();
     }
     catch (Microsoft.Expression.Encoder.SystemErrorException ex)
     {
         MessageBox.Show("Device is in use by another application");
     }
 }
예제 #5
0
        public EyeView()
        {
            InitializeComponent();

            // Bind the Video and Audio device properties of the
            // Webcam control to the SelectedValue property of
            // the necessary ComboBox.
            Binding bndg_1 = new Binding("SelectedValue");

            bndg_1.Source = VidDvcsComboBox;
            WebCamCtrl.SetBinding(Webcam.VideoDeviceProperty, bndg_1);

            Binding bndg_2 = new Binding("SelectedValue");

            bndg_2.Source = AudDvcsComboBox;
            WebCamCtrl.SetBinding(Webcam.AudioDeviceProperty, bndg_2);

            // Create directory for saving video files.
            string vidPath = @"C:\VideoClips";

            if (Directory.Exists(vidPath) == false)
            {
                Directory.CreateDirectory(vidPath);
            }

            // Create directory for saving image files.
            string imgPath = @"C:\WebcamSnapshots";

            if (Directory.Exists(imgPath) == false)
            {
                Directory.CreateDirectory(imgPath);
            }

            // Set some properties of the Webcam control
            WebCamCtrl.VideoDirectory = vidPath;
            WebCamCtrl.VidFormat      = VideoFormat.mp4;

            WebCamCtrl.ImageDirectory = imgPath;
            WebCamCtrl.PictureFormat  = ImageFormat.Jpeg;

            WebCamCtrl.FrameRate = 30;
            WebCamCtrl.FrameSize = new System.Drawing.Size(266, 200);

            // Find a/v devices connected to the machine.
            FindDevices();

            VidDvcsComboBox.SelectedIndex = 0;
            AudDvcsComboBox.SelectedIndex = 0;
        }
예제 #6
0
 private void SnapshotButton_Click(object sender, RoutedEventArgs e)
 {
     // Take snapshot of webcam image.
     WebCamCtrl.TakeSnapshot();
 }
예제 #7
0
 private void StopRecordButton_Click(object sender, RoutedEventArgs e)
 {
     // Stop recording of webcam video to harddisk.
     WebCamCtrl.StopRecording();
 }
예제 #8
0
 private void EndButton_Click(object sender, RoutedEventArgs e)
 {
     // Stop the display of webcam video.
     WebCamCtrl.StopCapture();
 }
예제 #9
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     WebCamCtrl.StopCapture();
     MainWindow.MWInstance.camButton.IsEnabled = true;
 }
예제 #10
0
 private void StopRecordButton_Click(object sender, RoutedEventArgs e)
 {
     WebCamCtrl.StopRecording();
 }
예제 #11
0
 private void camStopButton_Click(object sender, RoutedEventArgs e)
 {
     WebCamCtrl.StopCapture();
 }