DestroyCamera() private method

private DestroyCamera ( IntPtr camera ) : bool
camera System.IntPtr
return bool
Example #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);
         }
     }
 }
Example #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();
     }
 }
Example #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);
     }
 }