private void EyetrackerFound(object sender, EyeTrackerInfoEventArgs e) { // When an eyetracker is found on the network we set tracker tracker = e.EyeTrackerInfo; ConnectToTracker(tracker); start(); }
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; } } }
public void StartTracking(EyeTrackerInfo eyeTrackerInfo) { EyeTracker = eyeTrackerInfo.Factory.CreateEyeTracker(); EyeTracker.StartTracking(); EyeTracker.GazeDataReceived += _tracker_GazeDataReceived; IsTracking = true; }
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(); } }
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; } }
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(); }
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; }
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); }
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(); } } }
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(); }
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(); }
private void EyetrackerRemoved(object sender, EyeTrackerInfoEventArgs e) { // When an eyetracker disappears from the network we unset tracker tracker = null; DisconnectTracker(); }