/////////////////////////////////////////////////////////////////////////////// // Construction and Initializing methods // /////////////////////////////////////////////////////////////////////////////// #region CONSTRUCTION /// <summary> /// Initializes a new instance of the aslSettingsDialog class. /// </summary> /// <param name="tracker">The <see cref="AslTracker"/> to be used</param> /// <param name="aslSerialPort">The connection to the dll.</param> public aslSettingsDialog(AslTracker tracker, ASLSerialOutPort3Class aslSerialPort) { this.records = new ArrayList(); // call the Windows Form Designer generated method this.InitializeComponent(); this.aslTracker = tracker; this.userSettings = this.aslTracker.Settings; this.serialOutClass = aslSerialPort; // call the additional local initialize method this.CustomInitialize(); this.InitializeControls(); this.somethingChange = false; }
/// <summary> /// Creates the tracking interfaces for the selected /// tracking devices. If none is selected raises /// a <see cref="ShowTrackerSelectionDialog()" />. /// </summary> private void CreateTrackerInterfaces() { // Release existing tracking devices this.DisposeTrackerInterfaces(); // Reset tab control this.tclEyetracker.TabPages.Clear(); this.tclEyetracker.TabPages.Add(this.tbpMirametrix); this.tclEyetracker.TabPages.Add(this.tbpGazepoint); this.tclEyetracker.TabPages.Add(this.tbpTobii); this.tclEyetracker.TabPages.Add(this.tbpAlea); this.tclEyetracker.TabPages.Add(this.tbpSMIiViewX); this.tclEyetracker.TabPages.Add(this.tbpSMIRedM); this.tclEyetracker.TabPages.Add(this.tbpAsl); this.tclEyetracker.TabPages.Add(this.tbpMouseOnly); this.tclEyetracker.TabPages.Add(this.tbpGazetrackerIPClient); this.tclEyetracker.TabPages.Add(this.tbpGazetrackerDirectClient); this.tclEyetracker.TabPages.Add(this.tbpEyeTech); this.tclEyetracker.TabPages.Add(this.tbpHaytham); this.tclEyetracker.TabPages.Add(this.tbpEyeTribe); this.tclEyetracker.TabPages.Add(this.tbpSmartEye); // Read activated tracker value from the application settings string activatedTracker = Settings.Default.ActivatedHardwareTracker; var tracker = (HardwareTracker)Enum.Parse(typeof(HardwareTracker), activatedTracker); // Show dialog if no tracking device is selected. if (tracker == HardwareTracker.None) { tracker = this.ShowTrackerSelectionDialog(); Settings.Default.ActivatedHardwareTracker = tracker.ToString(); Settings.Default.Save(); } this.tclEyetracker.SuspendLayout(); if (tracker == (tracker | HardwareTracker.MouseOnly)) { // Create mouse only tracker var newMouseOnly = new MouseOnlyTracker( this, null, this.btnMouseOnlySubject, null, this.btnMouseOnlyRecord, this.txbMouseOnlySubjectName); this.trackerInterfaces.Add(HardwareTracker.MouseOnly, newMouseOnly); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpMouseOnly)) { this.tclEyetracker.TabPages.Remove(this.tbpMouseOnly); } } if (tracker == (tracker | HardwareTracker.Alea)) { // Create alea tracker var newAlea = new AleaTracker( ref this.labelCalibrationResult, this.tbpAlea, this, this.spcAleaControls, this.spcAleaTrackStatus.Panel1, this.spcAleaCalibPlot.Panel1, this.btnAleaShowOnPresentationScreen, this.btnAleaAcceptCalibration, this.btnAleaRecalibrate, this.btnAleaConnect, this.btnAleaSubjectName, this.btnAleaCalibrate, this.btnAleaRecord, this.txbAleaSubjectName); this.trackerInterfaces.Add(HardwareTracker.Alea, newAlea); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpAlea)) { this.tclEyetracker.TabPages.Remove(this.tbpAlea); } } if (tracker == (tracker | HardwareTracker.Tobii)) { // Create tobii tracker var newTobii = new TobiiTracker( this, this.spcTobiiControls, this.spcTobiiTrackStatus.Panel1, this.spcTobiiCalibPlot.Panel1, this.btnTobiiShowOnPresentationScreen, this.btnTobiiAcceptCalibration, this.btnTobiiRecalibrate, this.btnTobiiConnect, this.btnTobiiSubjectName, this.btnTobiiCalibrate, this.btnTobiiRecord, this.txbTobiiSubjectName); this.trackerInterfaces.Add(HardwareTracker.Tobii, newTobii); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpTobii)) { this.tclEyetracker.TabPages.Remove(this.tbpTobii); } } if (tracker == (tracker | HardwareTracker.Mirametrix)) { // Create Mirametrix tracker var newMirametrix = new MirametrixTracker( ref this.labelCalibrationResultMirametrix, this.tbpMirametrix, this, this.spcMirametrixControls, this.spcMirametrixTrackStatus.Panel1, this.spcMirametrixCalibPlot.Panel1, this.btnMirametrixShowOnPresentationScreen, this.btnMirametrixAcceptCalibration, this.btnMirametrixRecalibrate, this.btnMirametrixConnect, this.btnMirametrixSubjectName, this.btnMirametrixCalibrate, this.btnMirametrixRecord, this.txbMirametrixSubjectName); this.trackerInterfaces.Add(HardwareTracker.Mirametrix, newMirametrix); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpMirametrix)) { this.tclEyetracker.TabPages.Remove(this.tbpMirametrix); } } if (tracker == (tracker | HardwareTracker.Gazepoint)) { // Create Gazepoint tracker var newGazepoint = new GazepointTracker( ref this.labelCalibrationResultGazepoint, this.tbpGazepoint, this, this.spcGazepointControls, this.spcGazepointTrackStatus.Panel1, this.spcGazepointCalibPlot.Panel1, this.btnGazepointShowOnPresentationScreen, this.btnGazepointAcceptCalibration, this.btnGazepointRecalibrate, this.btnGazepointConnect, this.btnGazepointSubjectName, this.btnGazepointCalibrate, this.btnGazepointRecord, this.txbGazepointSubjectName); this.trackerInterfaces.Add(HardwareTracker.Gazepoint, newGazepoint); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpGazepoint)) { this.tclEyetracker.TabPages.Remove(this.tbpGazepoint); } } if (tracker == (tracker | HardwareTracker.EyeTech)) { // Create EyeTech tracker var newEyeTech = new EyeTechTracker( this, this.btnEyeTechConnect, this.btnEyeTechSubjectName, this.btnEyeTechCalibrate, this.btnEyeTechRecord, this.txbEyeTechSubjectName); this.trackerInterfaces.Add(HardwareTracker.EyeTech, newEyeTech); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpEyeTech)) { this.tclEyetracker.TabPages.Remove(this.tbpEyeTech); } } if (tracker == (tracker | HardwareTracker.SMIiViewX)) { // Create SMI tracker var newSMI = new SMIiViewXTracker( this, this.btnSMIiViewXConnect, this.btnSMIiViewXSubjectName, this.btnSMIiViewXCalibrate, this.btnSMIiViewXRecord, this.txbSMIiViewXSubjectName); this.trackerInterfaces.Add(HardwareTracker.SMIiViewX, newSMI); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpSMIiViewX)) { this.tclEyetracker.TabPages.Remove(this.tbpSMIiViewX); } } if (tracker == (tracker | HardwareTracker.SMIRedM)) { // Create SMI tracker var newSMI = new SMIRedMTracker( this, this.btnSMIRedMConnect, this.btnSMIRedMSubject, this.btnSMIRedMCalibrate, this.btnSMIRedMRecord, this.txbSMIRedMSubject); this.trackerInterfaces.Add(HardwareTracker.SMIRedM, newSMI); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpSMIRedM)) { this.tclEyetracker.TabPages.Remove(this.tbpSMIRedM); } } if (tracker == (tracker | HardwareTracker.ASL)) { // Create ASL tracker var newAsl = new AslTracker( this, this.btnAslConnect, this.btnAslSubjectName, this.btnAslCalibrate, this.btnAslRecord, this.txbAslSubjectName); this.trackerInterfaces.Add(HardwareTracker.ASL, newAsl); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpAsl)) { this.tclEyetracker.TabPages.Remove(this.tbpAsl); } } if (tracker == (tracker | HardwareTracker.GazetrackerIPClient)) { // Create ITU GazeTracker var newGazetrackerIPClient = new GazetrackerIPClientTracker( this, this.txbGazetrackerIPStatus, this.btnGazetrackerIPLaunch, this.btnGazetrackerIPConnect, this.btnGazetrackerIPSubject, this.btnGazetrackerIPRecord, this.txbGazetrackerIPSubject); this.trackerInterfaces.Add(HardwareTracker.GazetrackerIPClient, newGazetrackerIPClient); // Disable Usercam button by default, // because gazetracker often uses the first connected camera device // which would otherwise used by the usercam this.btnUsercam.Checked = false; this.spcPanelUserCam.Panel2Collapsed = true; } else { if (this.tclEyetracker.TabPages.Contains(this.tbpGazetrackerIPClient)) { this.tclEyetracker.TabPages.Remove(this.tbpGazetrackerIPClient); } } if (tracker == (tracker | HardwareTracker.GazetrackerDirectClient)) { // Create ITU GazeTracker var newGazetrackerDirectClient = new GazetrackerDirectClientTracker( this, this.eyeVideoControlGazetracker, this.btnGazetrackerDirectClientShowOnPresentationScreen, this.btnGazetrackerDirectClientConnect, this.btnGazetrackerDirectClientAdjust, this.btnGazetrackerDirectClientSubject, this.btnGazetrackerDirectClientCalibrate, this.btnGazetrackerDirectClientRecord, this.txbGazetrackerDirectClientSubject); this.trackerInterfaces.Add(HardwareTracker.GazetrackerDirectClient, newGazetrackerDirectClient); // Disable Usercam button by default, // because gazetracker often uses the first connected camera device // which would otherwise used by the usercam this.btnUsercam.Checked = false; this.spcPanelUserCam.Panel2Collapsed = true; } else { if (this.tclEyetracker.TabPages.Contains(this.tbpGazetrackerDirectClient)) { this.tclEyetracker.TabPages.Remove(this.tbpGazetrackerDirectClient); } } if (tracker == (tracker | HardwareTracker.Haytham)) { // Create ITU Haytham tracker var newHaythamClient = new HaythamTracker( this, this.spcHaytham, this.tscHaytham, this.txbHaythamStatus, this.btnHaythamLaunch, this.btnHaythamConnect, //this.btnHaythamCalibrate, this.btnHaythamSubject, this.btnHaythamRecord, this.txbHaythamSubject); this.trackerInterfaces.Add(HardwareTracker.Haytham, newHaythamClient); // Disable Usercam button by default, // because gazetracker often uses the first connected camera device // which would otherwise used by the usercam this.btnUsercam.Checked = false; this.spcPanelUserCam.Panel2Collapsed = true; } else { if (this.tclEyetracker.TabPages.Contains(this.tbpHaytham)) { this.tclEyetracker.TabPages.Remove(this.tbpHaytham); } } if (tracker == (tracker | HardwareTracker.TheEyeTribe)) { // Create the eye tribe tracker var newTheEyeTribe = new TheEyeTribeTracker( this, this.spcEyeTribeControls, this.spcEyeTribeTrackStatus.Panel1, this.spcEyeTribeCalibrationResult.Panel1, this.btnEyeTribeShowOnPresentationScreen, this.btnEyeTribeAccept, this.btnEyeTribeRecalibrate, this.btnEyeTribeConnect, this.btnEyeTribeSubject, this.btnEyeTribeCalibrate, this.btnEyeTribeRecord, this.txbEyeTribeSubject); this.trackerInterfaces.Add(HardwareTracker.TheEyeTribe, newTheEyeTribe); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpEyeTribe)) { this.tclEyetracker.TabPages.Remove(this.tbpEyeTribe); } } if (tracker == (tracker | HardwareTracker.SmartEye)) { // Create Smart Eye Tracker var newSmartEyeTracker = new SmartEyeTracker( this, this.spcSmartEyeControls, this.spcSmartEyeTrackStatus.Panel1, this.spcSmartEyeCalibPlot.Panel1, this.btnSmartEyeShowOnPresentationScreen, this.btnSmartEyeAcceptCalibration, this.btnSmartEyeRecalibrate, this.btnSmartEyeConnect, this.btnSmartEyeSubjectName, this.btnSmartEyeCalibrate, this.btnSmartEyeRecord, this.txbSmartEyeSubjectName); this.trackerInterfaces.Add(HardwareTracker.SmartEye, newSmartEyeTracker); } else { if (this.tclEyetracker.TabPages.Contains(this.tbpSmartEye)) { this.tclEyetracker.TabPages.Remove(this.tbpSmartEye); } } if (tracker == HardwareTracker.None) { this.tclEyetracker.TabPages.Add(this.tbpNoDevice); } this.tclEyetracker.ResumeLayout(); this.SwitchCurrentTracker(); }