Ejemplo n.º 1
0
        private void InitComponent(EyeDeviceType eyeDeviceType)
        {
            //Set Variables
            _eyeDeviceType = eyeDeviceType;
            if (_eyeDeviceType == EyeDeviceType.None)
            {
                return;
            }
            else if (_eyeDeviceType == EyeDeviceType.EyeTribe)
            {
                _eyeDeviceEyeTribe = new EyeDevice_EyeTribe();
            }
            else if (_eyeDeviceType == EyeDeviceType.Tobii)
            {
                _eyeDeviceTobii = new EyeDevice_Tobii();
            }

            //Set Button
            this.bt_connect.Background   = System.Windows.Media.Brushes.OrangeRed;
            this.bt_calibrate.IsEnabled  = false;
            this.bt_accept.IsEnabled     = false;
            this.bt_accept.Visibility    = System.Windows.Visibility.Hidden;
            this.lb_calibrationQ.Content = "Calibration Quality:";
            if (!hasFixation())
            {
                this.g_gdthreshold.Visibility = System.Windows.Visibility.Hidden;
            }

            this.g_eyeTraceBox.Children.Clear();
            switch (_eyeDeviceType)
            {
            case EyeDeviceType.EyeTribe:
                if (_eyeDeviceEyeTribe != null)
                {
                    this.g_eyeTraceBox.Children.Add(_eyeDeviceEyeTribe.GetGazeStatusBox());
                    _eyeDeviceEyeTribe.CalibrateOnResult += new EyeDevice_EyeTribe.CalibrateEventHandler(OnCalibrateResult);
                }
                break;

            case EyeDeviceType.Tobii:
                if (_eyeDeviceTobii != null)
                {
                    this.g_eyeTraceBox.Children.Add(_eyeDeviceTobii.GetGazeStatusBox());
                    _eyeDeviceTobii.OnFixation += new EyeDevice_Tobii.FixationEventHandler(OnFixation);
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
 public void Dispose()
 {
     //Close EyeTribeUC
     if (_eyeDeviceEyeTribe != null)
     {
         _eyeDeviceEyeTribe.CalibrateOnResult -= new EyeDevice_EyeTribe.CalibrateEventHandler(OnCalibrateResult);
         _eyeDeviceEyeTribe.Dispose();
         _eyeDeviceEyeTribe = null;
     }
     if (_eyeDeviceTobii != null)
     {
         _eyeDeviceTobii.OnFixation -= new EyeDevice_Tobii.FixationEventHandler(OnFixation);
         _eyeDeviceTobii.Dispose();
         _eyeDeviceTobii = null;
     }
 }