コード例 #1
0
 private void EyetrackerFound(object sender, EyeTrackerInfoEventArgs e)
 {
     // When an eyetracker is found on the network we set tracker
     tracker = e.EyeTrackerInfo;
     ConnectToTracker(tracker);
     start();
 }
コード例 #2
0
ファイル: Window1.xaml.cs プロジェクト: shimins/Eyetracking
        private void _trackButton_Click(object sender, RoutedEventArgs e)
        {
            if (_tracking)
            {
                _tracker.GazeDataReceived -= _tracker_GazeDataReceived;
                _tracker.StopTracking();

                _tracker.Dispose();
                _trackButton.Content = "Track";
                _tracking            = false;
            }
            else
            {
                EyeTrackerInfo etInfo = _trackerCombo.SelectedItem as EyeTrackerInfo;
                if (etInfo != null)
                {
                    _tracker = etInfo.Factory.CreateEyeTracker();

                    UpdateTrackBox();
                    UpdateScreen();

                    _tracker.StartTracking();

                    _tracker.GazeDataReceived      += _tracker_GazeDataReceived;
                    _tracker.TrackBoxChanged       += _tracker_TrackBoxChanged;
                    _tracker.XConfigurationChanged += _tracker_XConfigurationChanged;

                    _trackButton.Content = "Stop";
                    _tracking            = true;
                }
            }
        }
コード例 #3
0
 public void StartTracking(EyeTrackerInfo eyeTrackerInfo)
 {
     EyeTracker = eyeTrackerInfo.Factory.CreateEyeTracker();
     EyeTracker.StartTracking();
     EyeTracker.GazeDataReceived += _tracker_GazeDataReceived;
     IsTracking = true;
 }
コード例 #4
0
        private void ConnectToTracker(EyeTrackerInfo info)
        {
            try
            {
                _connectedTracker = info.Factory.CreateEyeTracker();
                _connectedTracker.ConnectionError += HandleConnectionError;
                _connectionName = info.ProductId;

                _syncManager = info.Factory.CreateSyncManager(_clock);

                _connectedTracker.GazeDataReceived += _connectedTracker_GazeDataReceived;
            }
            catch (EyeTrackerException ee)
            {
                if (ee.ErrorCode == 0x20000402)
                {
                    MessageBox.Show("Failed to upgrade protocol. " +
                                    "This probably means that the firmware needs" +
                                    " to be upgraded to a version that supports the new sdk.", "Upgrade Failed", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Eyetracker responded with error " + ee, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                DisconnectTracker();
            }
            catch (Exception)
            {
                MessageBox.Show("Could not connect to eyetracker.", "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DisconnectTracker();
            }
        }
コード例 #5
0
 private void connectButton_Click(object sender, RoutedEventArgs e)
 {
     if (eyeTrackerSelect.SelectedItem != null)
     {
         EyeTrackerInfo info = eyeTrackerSelect.SelectedItem as EyeTrackerInfo;
         tracker = info.Factory.CreateEyeTracker(EventThreadingOptions.BackgroundThread);
         tracker.RealTimeGazeData  = true;
         tracker.GazeDataReceived += new EventHandler <GazeDataEventArgs>(tracker_GazeDataReceived);
         calibrateButton.IsEnabled = true;
         startButton.IsEnabled     = true;
     }
 }
コード例 #6
0
        private void _connectButton_Click(object sender, EventArgs e)
        {
            // Disconnect existing connection
            DisconnectTracker();

            // Create new connection
            var selectedItem = GetSelectedItem();

            if (selectedItem != null)
            {
                _info = (EyeTrackerInfo)selectedItem.Tag;
                ConnectToTracker(_info);
            }
            UpdateUIElements();
        }
コード例 #7
0
ファイル: TrackerForm.cs プロジェクト: shimins/Eyetracking
        private static ListViewItem CreateTrackerListViewItem(EyeTrackerInfo info)
        {
            var trackerItem = new ListViewItem(info.ProductId);
            trackerItem.Name = info.ProductId;

            var sb = new StringBuilder();
            sb.AppendLine("Model: " + info.Model);
            sb.AppendLine("Status: " + info.Status);
            sb.AppendLine("Generation: " + info.Generation);
            sb.AppendLine("Product Id: " + info.ProductId);
            sb.AppendLine("Given Name: " + info.GivenName);
            sb.AppendLine("Firmware Version: " + info.Version);

            trackerItem.ToolTipText = sb.ToString();
            trackerItem.Tag = info;

            return trackerItem;
        }
コード例 #8
0
        private static ListViewItem CreateTrackerListViewItem(EyeTrackerInfo info)
        {
            var trackerItem = new ListViewItem(info.ProductId);

            trackerItem.Name = info.ProductId;

            var sb = new StringBuilder();

            sb.AppendLine("Model: " + info.Model);
            sb.AppendLine("Status: " + info.Status);
            sb.AppendLine("Generation: " + info.Generation);
            sb.AppendLine("Product Id: " + info.ProductId);
            sb.AppendLine("Given Name: " + info.GivenName);
            sb.AppendLine("Firmware Version: " + info.Version);

            trackerItem.ToolTipText = sb.ToString();
            trackerItem.Tag         = info;

            return(trackerItem);
        }
コード例 #9
0
        void browser_EyeTrackerFound(object sender, EyeTrackerInfoEventArgs e)
        {
            EyeTrackerInfo temp_etinfo = e.EyeTrackerInfo;

            if (temp_etinfo.Status == "ok")
            {
                etid = temp_etinfo.ProductId;
                et   = e.EyeTrackerInfo.Factory.CreateEyeTracker(EventThreadingOptions.BackgroundThread);

                //Setup event handlers for this tracker.
                et.CalibrationStarted += et_CalibrationStarted;
                et.CalibrationStopped += et_CalibrationStopped;
                et.ConnectionError    += et_ConnectionError;
                et.GazeDataReceived   += et_GazeDataRecieved;
                if (enabled)
                {
                    et.StartTracking();
                }
            }
        }
コード例 #10
0
ファイル: MainForm.cs プロジェクト: bjrnt/littlebobbytables
        private void ConnectToTracker(EyeTrackerInfo info)
        {
            try
            {
                _connectedTracker = info.Factory.CreateEyeTracker();
                _connectedTracker.ConnectionError += HandleConnectionError;
                _connectionName = info.ProductId;

                _syncManager = info.Factory.CreateSyncManager(_clock);

                _connectedTracker.GazeDataReceived += _connectedTracker_GazeDataReceived;
                _connectedTracker.FrameRateChanged += _connectedTracker_FrameRateChanged;
            }
            catch (EyeTrackerException ee)
            {
                if(ee.ErrorCode == 0x20000402)
                {
                    MessageBox.Show("Failed to upgrade protocol. " +
                        "This probably means that the firmware needs" +
                        " to be upgraded to a version that supports the new sdk.","Upgrade Failed",MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Eyetracker responded with error " + ee, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                DisconnectTracker();
            }
            catch(Exception)
            {
                MessageBox.Show("Could not connect to eyetracker.","Connection Failed",MessageBoxButtons.OK,MessageBoxIcon.Error);
                DisconnectTracker();
            }

            UpdateUIElements();
        }
コード例 #11
0
ファイル: TrackerForm.cs プロジェクト: shimins/Eyetracking
        private void _connectButton_Click(object sender, EventArgs e)
        {
            // Disconnect existing connection
            DisconnectTracker();

            // Create new connection
            var selectedItem = GetSelectedItem();
            if(selectedItem != null)
            {
                _info = (EyeTrackerInfo) selectedItem.Tag;
                ConnectToTracker(_info);
            }
            UpdateUIElements();
        }
コード例 #12
0
 private void EyetrackerRemoved(object sender, EyeTrackerInfoEventArgs e)
 {
     // When an eyetracker disappears from the network we unset tracker
     tracker = null;
     DisconnectTracker();
 }
コード例 #13
0
 public void StartTracking(EyeTrackerInfo eyeTrackerInfo)
 {
     EyeTracker = eyeTrackerInfo.Factory.CreateEyeTracker();
     EyeTracker.StartTracking();
     EyeTracker.GazeDataReceived += _tracker_GazeDataReceived;
     IsTracking = true;
 }