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); } } }
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); } }