コード例 #1
0
ファイル: Camera.xaml.cs プロジェクト: Ajay-Zou/ManyFoodZ
 private void RecordButton_Click(object sender, RoutedEventArgs e)
 {
     if (Directory.Exists(MainWindow.MWInstance.videoDir))
     {
         WebCamCtrl.VideoDirectory = MainWindow.MWInstance.videoDir;
         WebCamCtrl.StartRecording();
     }
 }
コード例 #2
0
ファイル: Camera.xaml.cs プロジェクト: Ajay-Zou/ManyFoodZ
 private void SnapshotButton_Click(object sender, RoutedEventArgs e)
 {
     if (Directory.Exists(MainWindow.MWInstance.imageDir))
     {
         WebCamCtrl.ImageDirectory = MainWindow.MWInstance.imageDir;
         WebCamCtrl.TakeSnapshot();
     }
 }
コード例 #3
0
ファイル: Camera.xaml.cs プロジェクト: Ajay-Zou/ManyFoodZ
 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
ファイル: Camera.xaml.cs プロジェクト: Ajay-Zou/ManyFoodZ
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     WebCamCtrl.StopCapture();
     MainWindow.MWInstance.camButton.IsEnabled = true;
 }
コード例 #10
0
ファイル: Camera.xaml.cs プロジェクト: Ajay-Zou/ManyFoodZ
 private void StopRecordButton_Click(object sender, RoutedEventArgs e)
 {
     WebCamCtrl.StopRecording();
 }
コード例 #11
0
ファイル: Camera.xaml.cs プロジェクト: Ajay-Zou/ManyFoodZ
 private void camStopButton_Click(object sender, RoutedEventArgs e)
 {
     WebCamCtrl.StopCapture();
 }