DestroyCamera() private méthode

private DestroyCamera ( IntPtr camera ) : bool
camera System.IntPtr
Résultat bool
Exemple #1
0
 void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (errquit == false)
     {
         if (campaused == true)
         {
             captureThread.Resume();
         }
         if (accpaused == false)
         {
             accelerometerTimer.Stop();
         }
         CLNUIDevice.SetMotorLED(motor, 0);
         if (motor != IntPtr.Zero)
         {
             CLNUIDevice.DestroyMotor(motor);
         }
         running = false;
         captureThread.Join();
         if (camera != IntPtr.Zero)
         {
             CLNUIDevice.StopCamera(camera);
             CLNUIDevice.DestroyCamera(camera);
         }
     }
 }
Exemple #2
0
 void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (running == true)
     {
         running = false;
         captureThread.Join();
         if (camera != IntPtr.Zero)
         {
             CLNUIDevice.StopCamera(camera);
             CLNUIDevice.DestroyCamera(camera);
         }
         camera = CLNUIDevice.CreateCamera(devSerial);
     }
     if (comboFEED.SelectedIndex == 0)
     {
         colorImage    = new NUIImage(640, 480);
         feed.Source   = colorImage.BitmapSource;
         running       = true;
         captureThread = new Thread(delegate()
         {
             CLNUIDevice.StartCamera(camera);
             while (running)
             {
                 CLNUIDevice.GetCameraColorFrameRGB32(camera, colorImage.ImageData, 500);
                 Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate()
                 {
                     colorImage.Invalidate();
                 });
             }
             CLNUIDevice.StopCamera(camera);
         });
         captureThread.IsBackground = true;
         captureThread.Start();
     }
     else
     {
         colorImage    = new NUIImage(640, 480);
         feed.Source   = colorImage.BitmapSource;
         running       = true;
         captureThread = new Thread(delegate()
         {
             CLNUIDevice.StartCamera(camera);
             while (running)
             {
                 CLNUIDevice.GetCameraDepthFrameRGB32(camera, colorImage.ImageData, 500);
                 Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate()
                 {
                     colorImage.Invalidate();
                 });
             }
             CLNUIDevice.StopCamera(camera);
         });
         captureThread.IsBackground = true;
         captureThread.Start();
     }
 }
Exemple #3
0
 void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     accelerometerTimer.Stop();
     CLNUIDevice.SetMotorLED(motor, 0);
     if (motor != IntPtr.Zero)
     {
         CLNUIDevice.DestroyMotor(motor);
     }
     if (captureThread != null)
     {
         running = false;
         captureThread.Join(100);
     }
     if (camera != IntPtr.Zero)
     {
         CLNUIDevice.DestroyCamera(camera);
     }
 }