Exemple #1
0
 public EyeTracker()
 {
     _gazeInputSourcePreview              = GazeInputSourcePreview.GetForCurrentView();
     _gazeInputSourcePreview.GazeEntered += GazeInputSourcePreview_GazeEntered;
     _gazeInputSourcePreview.GazeMoved   += GazeInputSourcePreview_GazeMoved;
     _gazeInputSourcePreview.GazeExited  += GazeInputSourcePreview_GazeExited;
 }
Exemple #2
0
        public MainPage()
        {
            InitializeComponent();
            DataContext = this;

            ShowIntermediatePoints = false;
            MaxGazeHistorySize     = 100;

            rootFrame = Window.Current.Content as Frame;
            gazeInputSourcePreview            = GazeInputSourcePreview.GetForCurrentView();
            gazeInputSourcePreview.GazeMoved += GazeInputSourcePreview_GazeMoved;

            startTime      = DateTime.Now;
            TimerLog.Text += "Start Time: " + startTime + "\n";

            ThreadPoolTimer timer = ThreadPoolTimer.CreatePeriodicTimer((t) =>
            {
                var currentTime = DateTime.Now;
                if ((currentTime - lastGazeTime).TotalSeconds > 10)
                {
                    _ = Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                              () =>
                    {
                        TimerLog.Text += "Timeout Triggered!\n";
                        TimerLog.Text += "Current Time: " + currentTime + "\n";
                        TimerLog.Text += "Last Time: " + lastGazeTime + "\n";
                    });
                }
            }, TimeSpan.FromSeconds(2));
        }
Exemple #3
0
        private void InitializeGazeTracing()
        {
            MaxGazeHistorySize = 100;

            gazeInputSourcePreview            = GazeInputSourcePreview.GetForCurrentView();
            gazeInputSourcePreview.GazeMoved += GazeInputSourcePreview_GazeMoved;
        }
Exemple #4
0
        public MainPage()
        {
            gazeInputSource            = GazeInputSourcePreview.GetForCurrentView();
            gazeInputSource.GazeMoved += GazeMoved; // Used only for the Chaos Controls

            Application.Current.Resources["ToggleButtonBackgroundChecked"] = Application.Current.Resources["SystemBaseMediumColor"];

            this.Loaded += MainPage_Loaded;
            this.InitializeComponent();
        }
Exemple #5
0
        public MainPage()
        {
            InitializeComponent();

            ShowIntermediatePoints = false;
            MaxGazeHistorySize     = 100;

            gazeInputSourcePreview            = GazeInputSourcePreview.GetForCurrentView();
            gazeInputSourcePreview.GazeMoved += GazeInputSourcePreview_GazeMoved;
        }
Exemple #6
0
        public GazeTracingPage()
        {
            this.InitializeComponent();
            DataContext = this;

            ShowIntermediatePoints = false;
            MaxGazeHistorySize     = 100;

            rootFrame = Window.Current.Content as Frame;
            gazeInputSourcePreview            = GazeInputSourcePreview.GetForCurrentView();
            gazeInputSourcePreview.GazeMoved += GazeInputSourcePreview_GazeMoved;
        }
Exemple #7
0
        public MediaPage()
        {
            InitializeComponent();
            _trackViewer = new TrackViewer();
            Loaded      += TrackingPage_Loaded;

            var gazeInputSource = GazeInputSourcePreview.GetForCurrentView();

            if (gazeInputSource != null)
            {
                gazeInputSource.GazeMoved += OnGazeInput;
            }
        }
        public MainPage()
        {
            InitializeComponent();

            MaxGazeHistorySize = 100000;

            rootFrame = Window.Current.Content as Frame;

            gazeInputSourcePreview            = GazeInputSourcePreview.GetForCurrentView();
            gazeInputSourcePreview.GazeMoved += GazeInputSourcePreview_GazeMoved;

            GazeHistoryItemsControl.ItemsSource = GazeHistory;
        }
        public MainPage()
        {
            InitializeComponent();

            gazeInputSourcePreview            = GazeInputSourcePreview.GetForCurrentView();
            gazeInputSourcePreview.GazeMoved += GazeInputSourcePreview_GazeMoved;

            displayInformation = DisplayInformation.GetForCurrentView();
            screenSize         = new Size((int)displayInformation.ScreenWidthInRawPixels,
                                          (int)displayInformation.ScreenHeightInRawPixels);
            screenSizeInchesWidth  = screenSize.Width / displayInformation.RawDpiX;
            screenSizeInchesHeight = screenSize.Height / displayInformation.RawDpiY;

            screenSizeMicrometersWidth  = screenSizeInchesWidth * 25400;
            screenSizeMicrometersHeight = screenSizeInchesHeight * 25400;
        }
Exemple #10
0
        /// <summary>
        /// Initialize gaze tracking.
        /// </summary>
        /// <param name="gazeDevice"></param>
        private async void TryEnableGazeTrackingAsync(GazeDevicePreview gazeDevice)
        {
            // If eye-tracking device is ready, declare event handlers and start tracking.
            if (IsSupportedDevice(gazeDevice))
            {
                timerGaze.Interval = new TimeSpan(0, 0, 0, 0, 20);
                timerGaze.Tick    += TimerGaze_Tick;

                SetGazeTargetLocation();

                // This must be called from the UI thread.
                gazeInputSource = GazeInputSourcePreview.GetForCurrentView();

                gazeInputSource.GazeEntered += GazeEntered;
                gazeInputSource.GazeMoved   += GazeMoved;
                gazeInputSource.GazeExited  += GazeExited;
            }
            // Notify if device calibration required.
            else if (gazeDevice.ConfigurationState ==
                     GazeDeviceConfigurationStatePreview.UserCalibrationNeeded ||
                     gazeDevice.ConfigurationState ==
                     GazeDeviceConfigurationStatePreview.ScreenSetupNeeded)
            {
                // Device isn't calibrated, so invoke the calibration handler.
                System.Diagnostics.Debug.WriteLine(
                    "Your device needs to calibrate. Please wait for it to finish.");
                await gazeDevice.RequestCalibrationAsync();
            }
            // Notify if device calibration underway.
            else if (gazeDevice.ConfigurationState ==
                     GazeDeviceConfigurationStatePreview.Configuring)
            {
                // Device is currently undergoing calibration.
                // A device update is sent when calibration complete.
                System.Diagnostics.Debug.WriteLine(
                    "Your device is being configured. Please wait for it to finish");
            }
            // Device is not viable.
            else if (gazeDevice.ConfigurationState == GazeDeviceConfigurationStatePreview.Unknown)
            {
                // Notify if device is in unknown state.
                // Reconfigure/recalbirate the device.
                System.Diagnostics.Debug.WriteLine(
                    "Your device is not ready. Please set up your device or reconfigure it.");
            }
        }
        private void InitializeGazeInputSource()
        {
            if (!_initialized)
            {
                if (_roots.Count != 0 && _devices.Count != 0)
                {
                    if (_gazeInputSource == null)
                    {
                        _gazeInputSource = GazeInputSourcePreview.GetForCurrentView();
                    }

                    if (_gazeInputSource != null)
                    {
                        _gazeInputSource.GazeEntered += OnGazeEntered;
                        _gazeInputSource.GazeMoved   += OnGazeMoved;
                        _gazeInputSource.GazeExited  += OnGazeExited;

                        _initialized = true;
                    }
                }
            }
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     gazeInputSourcePreview            = GazeInputSourcePreview.GetForCurrentView();
     gazeInputSourcePreview.GazeMoved += GazeInputSourcePreview_GazeMoved;
 }