Exemple #1
0
        /// <summary>
        /// Invokes the <see cref="SensorsUpdated"/> event.
        /// If the frame contains a gesture, also invokes the <see cref="GestureDetected"/> event.
        /// </summary>
        /// <param name="frame"></param>
        private void OnSensorsUpdated(SensorFrame frame)
        {
            if (SensorsUpdated != null)
            {
                SensorsUpdated.Invoke(frame);
            }

            if (frame.gestureId != GestureId.None)
            {
                if (GestureDetected != null)
                {
                    GestureDetected.Invoke(frame.gestureId);
                }

                switch (frame.gestureId)
                {
                case GestureId.DoubleTap:
                    if (DoubleTapDetected != null)
                    {
                        DoubleTapDetected.Invoke();
                    }
                    break;

                case GestureId.None:
                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
 /// <summary>
 /// Invokes the <see cref="SensorsUpdated"/> event.
 /// </summary>
 /// <param name="frame"></param>
 protected void OnSensorsUpdated(SensorFrame frame)
 {
     if (SensorsUpdated != null)
     {
         SensorsUpdated.Invoke(frame);
     }
 }
        private void TimerTick(object state)
        {
            if (!IsRecording)
            {
                return;
            }

            _output.WriteLine(string.Format(
                                  CultureInfo.InvariantCulture,
                                  "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},",
                                  Reading.LocationProvider ?? "None",
                                  Reading.Latitude,
                                  Reading.Longitude,
                                  Reading.Speed,
                                  Reading.Accuracy,
                                  Reading.AccelerationX,
                                  Reading.AccelerationY,
                                  Reading.AccelerationZ,
                                  Reading.GyroX,
                                  Reading.GyroY,
                                  Reading.GyroZ
                                  ));

            _count++;

            SensorsUpdated?.Invoke(this, new SensorsUpdatedEventArgs {
                Count       = _count,
                ElapsedTime = DateTime.Now.Subtract(_start)
            });
        }