/// <summary> /// Starts calibration. /// </summary> /// <param name="isRecalibrating"> /// whether to use recalibration or not. /// </param> /// <returns> /// <strong>True</strong> if calibration succeded, otherwise /// <strong>false</strong>. /// </returns> public override bool Calibrate(bool isRecalibrating) { try { var runner = new TobiiCalibrationRunner(); try { // Should hide TrackStatusDlg if (this.dlgTrackStatus != null) { this.ShowOnSecondaryScreenButton.BackColor = Color.Transparent; this.ShowOnSecondaryScreenButton.Text = "Show on presentation screen"; this.dlgTrackStatus.Close(); } // Start a new calibration procedure Calibration result = runner.RunCalibration(connectedTracker); // Show a calibration plot if everything went OK if (result != null) { this.tobiiCalibPlot.Initialize(result.Plot); this.ShowCalibPlot(); } else { MessageBox.Show("Not enough data to create a calibration (or calibration aborted)."); } } catch (EyetrackerException ee) { MessageBox.Show( "Failed to calibrate. Got exception " + ee, "Calibration Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { InformationDialog.Show( "Calibration failed", "Tobii calibration failed with the following message: " + Environment.NewLine + ex.Message, false, MessageBoxIcon.Error); this.CleanUp(); return(false); } return(true); }
/// <summary> /// Starts calibration. /// </summary> /// <param name="isRecalibrating"> /// whether to use recalibration or not. /// </param> /// <returns> /// <strong>True</strong> if calibration succeded, otherwise /// <strong>false</strong>. /// </returns> public override bool Calibrate(bool isRecalibrating) { try { var runner = new TobiiCalibrationRunner(); try { // Should hide TrackStatusDlg if (this.dlgTrackStatus != null) { this.ShowOnSecondaryScreenButton.BackColor = Color.Transparent; this.ShowOnSecondaryScreenButton.Text = "Show on presentation screen"; this.dlgTrackStatus.Close(); } // Start a new calibration procedure Calibration result = runner.RunCalibration(connectedTracker); // Show a calibration plot if everything went OK if (result != null) { this.tobiiCalibPlot.Initialize(result.Plot); this.ShowCalibPlot(); } else { MessageBox.Show("Not enough data to create a calibration (or calibration aborted)."); } } catch (EyetrackerException ee) { MessageBox.Show( "Failed to calibrate. Got exception " + ee, "Calibration Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { InformationDialog.Show( "Calibration failed", "Tobii calibration failed with the following message: " + Environment.NewLine + ex.Message, false, MessageBoxIcon.Error); this.CleanUp(); return false; } return true; }