private void Window_Closed(object sender, EventArgs e) { if (_reader != null) { _reader.Dispose(); } if (_sensor != null) { _sensor.Close(); } }
private void PageRoot_Unloaded(object sender, RoutedEventArgs e) { if (_reader != null) { _reader.Dispose(); } if (_sensor != null) { _sensor.Close(); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //註銷掉事件 bodyFrameReader.FrameArrived -= BodyFrameReader_FrameArrived; _reader.MultiSourceFrameArrived -= _reader_MultiSourceFrameArrived; poseture.Poseture_List -= Success_Change_word; dispatcherTimer.Tick -= DispatcherTimer_Tick; dispatcherGameTimer.Tick -= GameTimer_Tick; QRcodeTimer.Tick -= QRCodeTimer_Tick; //Stop Text To Speech textToSpeech.SpeechPause(); //Stop SoundPlay SoundPlay.PlayStop(); //停止偵測QRCode QRcodeTimer.Stop(); //暫停拍照倒數時間 dispatcherTimer.Stop(); //將音效的狀態設定為初始值 PostureSoundStatus = false; if (_reader != null) { _reader.Dispose(); _reader = null; } if (bodyFrameReader != null) { bodyFrameReader.Dispose(); bodyFrameReader = null; } if (null != this.convertStream) { this.convertStream.SpeechActive = false; } if (null != this.speechEngine) { this.speechEngine.SpeechRecognized -= this.SpeechRecognized; this.speechEngine.SpeechRecognitionRejected -= this.SpeechRejected; this.speechEngine.RecognizeAsyncStop(); } //用來判斷該呼叫哪個主頁面 BasicMethod.CallMainWindow(); }
void MainPage_Unloaded(object sender, RoutedEventArgs e) { if (_multiFrameSubscription != null) { _multiFrameSubscription.Dispose(); } _kinect.Close(); _kinect = null; _multiFrameReader.Dispose(); _multiFrameReader = null; }
//private void FaceReader_FrameArrived(object sender, HighDefinitionFaceFrameArrivedEventArgs e) //{ // using (var frame = e.FrameReference.AcquireFrame()) // { // if (frame != null && frame.IsFaceTracked) // { // frame.GetAndRefreshFaceAlignmentResult(_faceAlignment); // UpdateFacePoints(); // } // } //} //private void UpdateFacePoints() //{ // if (_facePointCloud == null) return; // var vertices = _faceModel.CalculateVerticesForAlignment(_faceAlignment); // pointsFace = new List<Vector3>(); // if (vertices.Count > 0) // { // //if (pointsFace.Count == 0) // //{ // // for (int index = 0; index < vertices.Count; index++) // // { // // //Ellipse ellipse = new Ellipse // // //{ // // // Width = 2.0, // // // Height = 2.0, // // // Fill = new SolidColorBrush(Colors.Blue) // // //}; // // pointsFace.Add(new Vector3(vertices[index].X, vertices[index].Y, vertices[index].Z)); // // //_points.Add(ellipse); // // } // // //foreach (Vector3 v in _points) // // //{ // // // canvas.Children.Add(ellipse); // // //} // //} // for (int index = 0; index < vertices.Count; index++) // { // pointsFace.Add(new Vector3(vertices[index].X, vertices[index].Y, vertices[index].Z)); // CameraSpacePoint vertice = vertices[index]; // DepthSpacePoint point = this.coordinateMapper.MapCameraPointToDepthSpace(vertice); // if (float.IsInfinity(point.X) || float.IsInfinity(point.Y)) // return; // //Ellipse ellipse = _points[index]; // //Canvas.SetLeft(ellipse, point.X); // //Canvas.SetTop(ellipse, point.Y); // } // } //} //void FaceReader_FrameArrived(object sender, FaceFrameArrivedEventArgs e) //{ // using (var frame = e.FrameReference.AcquireFrame()) // { // if (frame != null) // { // if (frame != null && frame.IsFaceTracked) // { // frame.GetAndRefreshFaceAlignmentResult(_faceAlignment); // UpdateFacePoints(); // } // // 4) Get the face frame result // FaceFrameResult result = frame.FaceFrameResult; // if (result != null) // { // FaceFrame ff = frame as FaceFrame; // // 5) Do magic! // // Get the face points, mapped in the color space. // var eyeLeft = result.FacePointsInColorSpace[FacePointType.EyeLeft]; // var eyeRight = result.FacePointsInColorSpace[FacePointType.EyeRight]; // var nose = result.FacePointsInColorSpace[FacePointType.Nose]; // var mouthLeft = result.FacePointsInColorSpace[FacePointType.MouthCornerLeft]; // var mouthRight = result.FacePointsInColorSpace[FacePointType.MouthCornerRight]; // var eyeLeftClosed = result.FaceProperties[FaceProperty.LeftEyeClosed]; // var eyeRightClosed = result.FaceProperties[FaceProperty.RightEyeClosed]; // var mouthOpen = result.FaceProperties[FaceProperty.MouthOpen]; // // // Position the canvas UI elements // // Canvas.SetLeft(ellipseEyeLeft, eyeLeft.X - ellipseEyeLeft.Width / 2.0); // // Canvas.SetTop(ellipseEyeLeft, eyeLeft.Y - ellipseEyeLeft.Height / 2.0); // // Canvas.SetLeft(ellipseEyeRight, eyeRight.X - ellipseEyeRight.Width / 2.0); // // Canvas.SetTop(ellipseEyeRight, eyeRight.Y - ellipseEyeRight.Height / 2.0); // // Canvas.SetLeft(ellipseNose, nose.X - ellipseNose.Width / 2.0); // // Canvas.SetTop(ellipseNose, nose.Y - ellipseNose.Height / 2.0); // // Canvas.SetLeft(ellipseMouth, ((mouthRight.X + mouthLeft.X) / 2.0) - ellipseMouth.Width / 2.0); // // Canvas.SetTop(ellipseMouth, ((mouthRight.Y + mouthLeft.Y) / 2.0) - ellipseMouth.Height / 2.0); // // ellipseMouth.Width = Math.Abs(mouthRight.X - mouthLeft.X); // // // Display or hide the ellipses // // if (eyeLeftClosed == DetectionResult.Yes || eyeLeftClosed == DetectionResult.Maybe) // // { // // ellipseEyeLeft.Visibility = Visibility.Collapsed; // // } // // else // // { // // ellipseEyeLeft.Visibility = Visibility.Visible; // // } // // if (eyeRightClosed == DetectionResult.Yes || eyeRightClosed == DetectionResult.Maybe) // // { // // ellipseEyeRight.Visibility = Visibility.Collapsed; // // } // // else // // { // // ellipseEyeRight.Visibility = Visibility.Visible; // // } // // if (mouthOpen == DetectionResult.Yes || mouthOpen == DetectionResult.Maybe) // // { // // ellipseMouth.Height = 50.0; // // } // // else // // { // // ellipseMouth.Height = 20.0; // // } // } // } // } //} public override void StopScanner() { isScanning = false; if (scannerReader != null) { scannerReader.Dispose(); scannerReader = null; } if (scannerSensor != null) { scannerSensor.Close(); scannerSensor = null; } if (bodyFrameReader != null) { this.bodyFrameReader.Dispose(); bodyFrameReader = null; } if (BVHFile != null) { BVHFile.Close(); } //if (_faceReader != null) //{ // _faceReader.Dispose(); // _faceReader = null; //} //if (_faceSource != null) //{ // _faceSource = null; //} //if (_facePointCloud != null) //{ // _faceModel.Dispose(); // _facePointCloud = null; //} }
void OnApplicationQuit() { runDepthThread = false; if (Queue != null) { Queue.HardStop(); } Thread.Sleep(100); reader.Dispose(); sensor.Close(); }
private void OnApplicationQuit() { new[] { colorBuffer, colorSpacePointBuffer, cameraSpacePointBuffer, pointCloudBuffer } .ToList().ForEach(b => b.Release()); reader.Dispose(); if (kinect != null) { if (kinect.IsOpen) { kinect.Close(); } } }
public void ScannerClose() { if (_reader != null) { _reader.Dispose(); } if (_sensor != null) { _sensor.Close(); } }
protected override void OnClosed(EventArgs e) { base.OnClosed(e); if (frameReader != null) { frameReader.Dispose(); } if (sensor != null) { sensor.Close(); } }
void OnApplicationQuit() { if (_multiSourceReader != null) { _multiSourceReader.Dispose(); _multiSourceReader = null; } if (_kinectSenesor != null && _kinectSenesor.IsOpen) { _kinectSenesor.Close(); _kinectSenesor = null; } }
private void CloseKinect(object sender, CancelEventArgs e) { if (null != FrameReader) { FrameReader.Dispose(); FrameReader = null; } if (null != Sensor) { Sensor.Close(); Sensor = null; } }
public void ShutdownServer() { Console.WriteLine("Shutting down server... "); if (connections != null && connections.Count != 0) { lock (connections) { for (int i = connections.Count - 1; i >= 0; i--) { CloseConnection(connections[i]); } } } if (gestureDetectorList != null && gestureDetectorList.Count != 0) { lock (gestureDetectorList) { foreach (var gestureDetector in gestureDetectorList) { gestureDetector.Dispose(); } } } if (serverSocket != null) { serverSocket.Close(); } if (handlerSocket != null) { handlerSocket.Close(); } if (_reader != null) { _reader.Dispose(); } if (_sensor != null) { _sensor.Close(); } Console.WriteLine("Done!"); Environment.Exit(0); }
private void Page_Unloaded(object sender, EventArgs e) { if (mulSourceReader != null) { // MultiSourceFrameReder is IDisposable mulSourceReader.Dispose(); mulSourceReader = null; } if (kinectSensor != null) { kinectSensor.Close(); kinectSensor = null; } }
public void Stop() { if (multiReader != null) { multiReader.MultiSourceFrameArrived -= multiReader_MultiSourceFrameArrived; multiReader.Dispose(); multiReader = null; } if (kinect != null) { kinect.Close(); kinect = null; } }
void OnApplicationQuit() { // 关闭kinect if (bIsOpen) { Closekinect(); } if (_Reader != null) { _Reader.Dispose(); _Reader = null; } if (_Sensor != null) { if (_Sensor.IsOpen) { _Sensor.Close(); } _Sensor = null; } }
public void CloseKinect() { if (multiSourceReader != null) { // MultiSourceFrameReder is IDisposable multiSourceReader.Dispose(); multiSourceReader = null; } if (kinectSensor != null) { kinectSensor.Close(); kinectSensor = null; } }
/// <summary> /// Execute shutdown tasks /// </summary> /// <param name="sender">object sending the event</param> /// <param name="e">event arguments</param> private void WindowClose(object sender, CancelEventArgs e) { if (multiFrameSourceReader != null) { // MultiSourceFrameReder is IDisposable multiFrameSourceReader.Dispose(); multiFrameSourceReader = null; } if (kinectSensor != null) { kinectSensor.Close(); kinectSensor = null; } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (multiReader != null) { multiReader.MultiSourceFrameArrived -= multiReader_MultiSourceFrameArrived; multiReader.Dispose(); multiReader = null; } if (kinect != null) { kinect.Close(); kinect = null; } }
private void OnDestroy() { if (multiSourceReader != null) { multiSourceReader.Dispose(); multiSourceReader = null; } if (sensor != null) { if (sensor.IsOpen && ManageSensor) { sensor.Close(); } sensor = null; } if (positionBuffer != null) { positionBuffer.Dispose(); positionBuffer = null; } if (tempPositionTexture != null) { Destroy(tempPositionTexture); tempPositionTexture = null; } if (colorSourceTexture != null) { Destroy(colorSourceTexture); colorSourceTexture = null; } if (tempColorTexture != null) { Destroy(tempColorTexture); tempColorTexture = null; } if (depthToColorMapBuffer != null) { depthToColorMapBuffer.Dispose(); depthToColorMapBuffer = null; } }
private void Window_Closed(object sender, EventArgs e) { if (_reader != null) { _reader.Dispose(); } if (_sensor != null) { _sensor.Close(); Console.WriteLine("closing..."); locationSocket.Close(); footstepSocket.Close(); } }
// オブジェクトが破棄されるときに実行 終了処理 void OnDestroy() { // リーダーを終了 if (reader != null) { reader.Dispose(); reader = null; } // センサーを終了 if (sensor != null) { sensor.Close(); sensor = null; } }
/// <summary> /// Execute shutdown tasks /// </summary> /// <param name="sender">object sending the event</param> /// <param name="e">event arguments</param> private void MainWindow_Closing(object sender, CancelEventArgs e) { if (_multiFrameSourceReader != null) { // MultiSourceFrameReder is IDisposable _multiFrameSourceReader.Dispose(); _multiFrameSourceReader = null; } if (_kinectSensor == null) { return; } _kinectSensor.Close(); _kinectSensor = null; }
private void Window_Unloaded(object sender, RoutedEventArgs e) { if (_playersController != null) { _playersController.Stop(); } if (_reader != null) { _reader.Dispose(); } if (_sensor != null) { _sensor.Close(); } }
private void Page_Unloaded(object sender, RoutedEventArgs e) { if (_userReporter != null) { _userReporter.Stop(); } if (_reader != null) { _reader.Dispose(); } if (_sensor != null) { _sensor.Close(); } }
public void Dispose() { if (!isDisposed) { syncProcessing.Enter(); isDisposed = true; reader?.Dispose(); floatDepthFrame?.Dispose(); pointCloudFrame?.Dispose(); surfaceFrame?.Dispose(); reconstruction?.Dispose(); } }
public void Dispose() { // Stop the reader, the body tracking, the sensor and release any resources. if (_reader != null) { _reader.Dispose(); _reader = null; } if (_sensor != null && _sensor.IsOpen) { _sensor.Close(); _sensor = null; } GC.SuppressFinalize(this); }
private void MainWindow_Unloaded(object sender, RoutedEventArgs e) { if (_reader != null) { _reader.Dispose(); } if (_sensor != null) { _sensor.Close(); } if (_gestureDetector != null) { _gestureDetector.GestureRecongized -= _gestureDetector_GestureRecongized; } }
private void bStop_Click(object sender, EventArgs e) { try { if (_kSensor != null) { _kSensor.Close(); _fReader.Dispose(); _fReader = null; } bCapture.Enabled = true; bStop.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (multiFrameReader != null) { multiFrameReader.Dispose(); multiFrameReader = null; } if (gestureFrameReader != null) { gestureFrameReader.Dispose(); gestureFrameReader = null; } if (kinect != null) { kinect.Close(); kinect = null; } }
private void OnApplicationQuit() { if (_Reader != null) { _Reader.Dispose(); _Reader = null; } if (_Sensor != null) { if (_Sensor.IsOpen) { _Sensor.Close(); } _Sensor = null; } }