Esempio n. 1
0
        public MainWindowModel()
        {
            IsUserPresent = false;
            IsTrackingGaze = false;
            IsTrackingGazeSupported = true;

            // Create and start the WpfEyeXHost. Starting the host means
            // that it will connect to the EyeX Engine and be ready to
            // start receiving events and get the current values of
            // different engine states. In this sample we will be using
            // the UserPresence engine state.
            _eyeXHost = new WpfEyeXHost();

            // Register an status-changed event listener for UserPresence.
            // NOTE that the event listener must be unregistered too. This is taken care of in the Dispose(bool) method.
            _eyeXHost.UserPresenceChanged += EyeXHost_UserPresenceChanged;
            _eyeXHost.GazeTrackingChanged += EyeXHost_GazeTrackingChanged;

            // Start the EyeX host.
            _eyeXHost.Start();

            // Wait until we're connected.
            if (_eyeXHost.WaitUntilConnected(TimeSpan.FromSeconds(5)))
            {
                // Make sure the EyeX Engine version is equal to or greater than 1.4.
                var engineVersion = _eyeXHost.GetEngineVersion().Result;
                if (engineVersion.Major != 1 || engineVersion.Major == 1 && engineVersion.Minor < 4)
                {
                    IsTrackingGazeSupported = false;
                }
            }
        }
Esempio n. 2
0
 public App()
 {
     _eyeXHost = new WpfEyeXHost();
     _eyeXHost.Start();
 }