示例#1
0
        public async Task <bool> CreateProfileAsync()
        {
            StartStatusListening();

            // Wait for a good configuration status.
            while (_configurationStatus == default(EyeTrackingConfigurationStatus))
            {
                await _semaphore.WaitAsync();
            }

            // Wait for device to become configured.
            var validConfiguration = false;

            for (var iteration = 0; iteration < 10 && !validConfiguration; iteration++)
            {
                switch (_configurationStatus)
                {
                case EyeTrackingConfigurationStatus.Valid:
                    validConfiguration = true;
                    break;

                case EyeTrackingConfigurationStatus.InvalidMonitorConfiguration:
                    _eyeXHost.LaunchDisplaySetup();
                    await WaitForConfigurationToCompleteAsync();

                    break;

                case EyeTrackingConfigurationStatus.InvalidCalibration:
                    _eyeXHost.LaunchProfileCreation();
                    await WaitForConfigurationToCompleteAsync();

                    break;

                default:
                    await Task.Delay(TimeSpan.FromSeconds(5));

                    break;
                }
            }

            StopStatusListening();

            return(validConfiguration);
        }
示例#2
0
        public static void Main(string[] args)
        {
            using (var eyeXHost = new EyeXHost())
            {
                eyeXHost.Start();

                Console.WriteLine("EYEX CONFIGURATION TOOLS");
                Console.WriteLine("========================");
                Console.WriteLine();
                Console.WriteLine("T) Test calibration");
                Console.WriteLine("G) Guest calibration");
                Console.WriteLine("R) Recalibrate");
                Console.WriteLine("D) Display Setup");
                Console.WriteLine("P) Create Profile");

                var key = Console.ReadKey(true).Key;
                switch (key)
                {
                case ConsoleKey.T:
                    eyeXHost.LaunchCalibrationTesting();
                    break;

                case ConsoleKey.G:
                    eyeXHost.LaunchGuestCalibration();
                    break;

                case ConsoleKey.R:
                    eyeXHost.LaunchRecalibration();
                    break;

                case ConsoleKey.D:
                    eyeXHost.LaunchDisplaySetup();
                    break;

                case ConsoleKey.P:
                    eyeXHost.LaunchProfileCreation();
                    break;
                }
            }
        }