private void Page_KeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.Escape)
     {
         App.Current.Exit();
     }
     else if (e.Key == Windows.System.VirtualKey.Delete ||
              e.Key == Windows.System.VirtualKey.Back)
     {
         GazeHistory.Clear();
     }
 }
Example #2
0
        private void GazeInputSourcePreview_GazeMoved(GazeInputSourcePreview sender, GazeMovedPreviewEventArgs args)
        {
            var point = args.CurrentPoint.EyeGazePosition;

            if (!point.HasValue)
            {
                return;
            }

            GazeHistory.Add(point.Value);
            if (GazeHistory.Count > MaxGazeHistorySize)
            {
                GazeHistory.RemoveAt(0);
            }
        }
Example #3
0
        private void UpdateGazeHistory(GazePointPreview pt)
        {
            if (!pt.EyeGazePosition.HasValue)
            {
                return;
            }

            var transform = rootFrame.TransformToVisual(this);
            var point     = transform.TransformPoint(pt.EyeGazePosition.Value);

            GazeHistory.Add(point);
            if (GazeHistory.Count > MaxGazeHistorySize)
            {
                GazeHistory.RemoveAt(0);
            }
        }
        private void UpdateGazeHistory(GazePointPreview pt)
        {
            if (pt.EyeGazePosition.HasValue)
            {
                var transform = rootFrame.TransformToVisual(this);
                var newPoint  = transform.TransformPoint(pt.EyeGazePosition.Value);

                if (oldPoint.HasValue)
                {
                    GazeHistory.Add(new PointPair(oldPoint.Value, newPoint));

                    if (GazeHistory.Count > MaxGazeHistorySize)
                    {
                        GazeHistory.RemoveAt(0);
                    }
                }

                oldPoint = newPoint;
            }
        }