//******************************************* // CALIBRATION //******************************************* //button click handler used to load and connect the application to the eye tracking server private void Cal_Connect_Button_Click(object sender, EventArgs e) { // "Future release" launch SMI Eye tracker server automatically ETConnection connectToEyeTracker = new ETConnection(); int res = connectToEyeTracker.connect(ETDevice); if (res == 104)//res 104 is used if no server has been started { DialogResult messagebox = MessageBox.Show("Could not connect to SMI Eye Tracker\n\nPlease check the Eye Tracker server has been started", "Error Connecting to Eye Tracker Server", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (messagebox == DialogResult.Retry) { Cal_Connect_Button_Click(sender, e); } } else if (res != 1)//any other message (see SMI manual for error codes) { //display message box MessageBox.Show("Could not connect to Eye Tracker!", "Error Connecting to Eye Tracker Server", MessageBoxButtons.OK, MessageBoxIcon.Error); } else//connection succesful enable next step { //Display eye position on the observation monitor trackingMonitor = new ETTrackingMonitor(ETDevice, observationMonitorPictureBox); //m_EyeImageCallback = new GetEyeImageCallback(GetEyeImageCallbackFunction); //ETDevice.iV_SetEyeImageCallback(m_EyeImageCallback); //enable trackingmonitor and eyeimage monitor button (code should auto load this view first time) Obs_TrackingMonitor_Button.Enabled = true; Obs_EyeImageMonitor_Button.Enabled = true; //Allow/Enable the next step (Calibration) Cal_Calibrate_Button.Enabled = true; //start the ET positition data updater Thread etPoisitionUpdater = new Thread(new ThreadStart(updateETEyePosition)); etPoisitionUpdater.Name = "Update ET position data Thread"; etPoisitionUpdater.Start(); } }
//******************************************* // OBSERVATION SECTION //******************************************* // button click handler used to load the eye position monitor (show your eyes are in correct position). It is only enabled after your have succesfully connected to the ET. private void Obs_TrackingMonitor_Button_Click(object sender, EventArgs e) { trackingMonitor = new ETTrackingMonitor(ETDevice, observationMonitorPictureBox); }