Ejemplo n.º 1
0
        /// <summary>
        /// Starts sensor and registers listener to a sensor
        /// </summary>
        /// <param name="listener">Event handler to listen sensor events</param>
        public void Start(EventHandler <SensorEventArgs> listener)
        {
            handler = (sender, e) =>
            {
                listener?.Invoke(this,
                                 new SensorEventArgs(new List <float>()
                {
                    e.X, e.Y, e.Z
                }));
            };

            sensor.DataUpdated += handler;
            sensor.Start();
        }
Ejemplo n.º 2
0
        protected override void OnResume()
        {
            if (!initialized)
            {
                var time = GetCurrentTime();
                witchWatch.Time = time.UtcTimestamp + TimeSpan.FromMilliseconds(time.Millisecond);
                witchWatch.MoveHands(900).ContinueWith((Action <System.Threading.Tasks.Task <bool> >)((System.Threading.Tasks.Task <bool> t) => {
                    witchWatch.Run();
                    this.gravity.Start();
                }));
                initialized = true;
            }
            else
            {
                witchWatch.Run();
                gravity.Start();
            }

            base.OnResume();
        }