public void GenerateBalanceKeithleyCalibrationData(DataUpdateDelegate graphUpdate, float stopValue, int readingDelay, int stepSize, string outFile)
        {
            CalibrationRunner runner = new CalibrationRunner(graphUpdate, stopValue, readingDelay, stepSize, outFile);
            Thread tThread = new Thread(new ThreadStart(runner.RunTest));

            KeepRunningTest = true;
            tThread.Start();
        }
        public async Task<string> Calibrate(Window parentWindow)
        {
            Log.Info("Attempting to calibrate using the TheEyeTribe calibration runner.");
            
            var calRunner = new CalibrationRunner();

            if (parentWindow != null)
            {
                calRunner.Owner = parentWindow; //Setting the owner preserves the z-order of the parent and child windows if the focus is shifted away from the child window (otherwise the child popup will be hidden)
            }

            var resultTask = Observable
                .FromEventPattern<CalibrationRunnerEventArgs>(
                    eh => calRunner.OnResult += eh,
                    eh => calRunner.OnResult -= eh)
                .FirstAsync()
                .Select(i => i.EventArgs)
                .ToTask();

            calRunner.Width = 100;
            calRunner.Height = 100;

            calRunner.Start();

            var calibrateArgs = await resultTask;

            calRunner.Owner = null;
            calRunner.Close();

            switch (calibrateArgs.Result)
            {
                case CalibrationRunnerResult.Success:
                    var message = string.Format("Calibration success! Accuracy (Avg Error Degree = {0})",
                        calibrateArgs.CalibrationResult.AverageErrorDegree);
                    Log.Info(message);
                    return message;

                case CalibrationRunnerResult.Abort:
                    throw new ApplicationException(string.Format("Calibration aborted with message: '{0}'", calibrateArgs.Message));

                case CalibrationRunnerResult.Error:
                    throw new ApplicationException(string.Format("An error occurred during calibration. Message: '{0}'", calibrateArgs.Message));

                case CalibrationRunnerResult.Failure:
                    throw new ApplicationException(string.Format("Calibration failed with message: '{0}'", calibrateArgs.Message));

                case CalibrationRunnerResult.Unknown:
                    throw new ApplicationException(string.Format("Calibration stopped for an unknown reason. Message: '{0}'", calibrateArgs.Message));
            }

            return null;
        }
        public async Task<string> Calibrate(Window parentWindow)
        {
            Log.Info("Attempting to calibrate using the TheEyeTribe calibration runner.");
            
            var calRunner = new CalibrationRunner();

            if (parentWindow != null)
            {
                calRunner.Owner = parentWindow; //Setting the owner preserves the z-order of the parent and child windows if the focus is shifted away from the child window (otherwise the child popup will be hidden)
            }

            var resultTask = Observable
                .FromEventPattern<CalibrationRunnerEventArgs>(
                    eh => calRunner.OnResult += eh,
                    eh => calRunner.OnResult -= eh)
                .FirstAsync()
                .Select(i => i.EventArgs)
                .ToTask();

            calRunner.Width = 100;
            calRunner.Height = 100;

            calRunner.Start();

            var calibrateArgs = await resultTask;

            calRunner.Owner = null;
            calRunner.Close();

            switch (calibrateArgs.Result)
            {
                case CalibrationRunnerResult.Success:
                    var message = string.Format(Resources.CALIBRATION_SUCCESS,
                        calibrateArgs.CalibrationResult.AverageErrorDegree);
                    Log.Info(message);
                    return message;

                case CalibrationRunnerResult.Abort:
                    throw new ApplicationException(string.Format(Resources.CALIBRATION_ABORT_MESSAGE, calibrateArgs.Message));

                case CalibrationRunnerResult.Error:
                    throw new ApplicationException(string.Format(Resources.CALIBRATION_ERROR_MESSAGE, calibrateArgs.Message));

                case CalibrationRunnerResult.Failure:
                    throw new ApplicationException(string.Format(Resources.CALIBRATION_FAIL_MESSAGE, calibrateArgs.Message));

                case CalibrationRunnerResult.Unknown:
                    throw new ApplicationException(string.Format(Resources.CALIBRATION_STOPPED_MESSAGE, calibrateArgs.Message));
            }

            return null;
        }
Ejemplo n.º 4
0
        private void Calibrate()
        {
            //Run the calibration on 'this' monitor
            var ActiveScreen = Screen.FromHandle(new WindowInteropHelper(this).Handle);

            // Initialize and start the calibration
            CalibrationRunner calRunner = new CalibrationRunner(ActiveScreen, ActiveScreen.Bounds.Size, 9);

            var isCalibrated = calRunner.Start();
            if (!isCalibrated) return;

            // Show the rating of last accepted current calibration
            RatingText.Text = RatingFunction(GazeManager.Instance.LastCalibrationResult);
        }
Ejemplo n.º 5
0
        private void Calibrate()
        {
            //Run the calibration on 'this' monitor
            var ActiveScreen = Screen.FromHandle(new WindowInteropHelper(this).Handle);

            // Initialize and start the calibration
            CalibrationRunner calRunner = new CalibrationRunner(ActiveScreen, ActiveScreen.Bounds.Size, 9);

            var isCalibrated = calRunner.Start();

            if (!isCalibrated)
            {
                return;
            }

            // Show the rating of last accepted current calibration
            RatingText.Text = RatingFunction(GazeManager.Instance.LastCalibrationResult);
        }
Ejemplo n.º 6
0
    /// <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
      {
        // Should hide TrackStatusDlg
        if (this.dlgTrackStatus != null)
        {
          this.ShowOnSecondaryScreenButton.BackColor = Color.Transparent;
          this.ShowOnSecondaryScreenButton.Text = "Show on presentation screen";
          this.dlgTrackStatus.Close();
        }

        var pointCount = 9;

        switch (this.theEyeTribeSettings.CalibrationPointCount)
        {
          case TheEyeTribeCalibrationPoints.Nine:
            pointCount = 9;
            break;
          case TheEyeTribeCalibrationPoints.Twelve:
            pointCount = 12;
            break;
          case TheEyeTribeCalibrationPoints.Sixteen:
            pointCount = 16;
            break;
        }

        // Start a new calibration procedure
        var calRunner = new CalibrationRunner(
          PresentationScreen.GetPresentationScreen(),
          PresentationScreen.GetPresentationBounds().Size,
          pointCount);
        calRunner.BackgroundColor = new System.Windows.Media.SolidColorBrush(ToMediaColor(this.theEyeTribeSettings.CalibrationBackgroundColor));
        calRunner.HelpVisibility = this.theEyeTribeSettings.DisplayHelp ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
        calRunner.PointColor = new System.Windows.Media.SolidColorBrush(ToMediaColor(this.theEyeTribeSettings.CalibrationPointColor));
        calRunner.PointRecordingTime = this.theEyeTribeSettings.PointDisplayTime;

        calRunner.Start(); // blocks until complete
        calRunner.OnResult += calRunner_OnResult;
      }
      catch (Exception ex)
      {
        InformationDialog.Show(
          "Calibration failed",
          "TheEyeTribe calibration failed with the following message: " + Environment.NewLine + ex.Message,
          false,
          MessageBoxIcon.Error);

        this.CleanUp();
        return false;
      }

      return true;
    }
Ejemplo n.º 7
0
        private void Calibrate()
        {
            // Update screen to calibrate where the window currently is
            activeScreen = Screen.FromHandle(new WindowInteropHelper(this).Handle);

            // Initialize and start the calibration
            CalibrationRunner calRunner = new CalibrationRunner(activeScreen, activeScreen.Bounds.Size, 9);
            calRunner.OnResult += calRunner_OnResult;
            calRunner.Start();
        }
Ejemplo n.º 8
0
        private void Calibrate()
        {
            btnAction.Content = "Re-Calibrate";

            //Run the calibration on 'this' monitor
            var ActiveScreen = Screen.FromHandle(new WindowInteropHelper(this).Handle);

            // Initialize and start the calibration
            CalibrationRunner calRunner = new CalibrationRunner(ActiveScreen, ActiveScreen.Bounds.Size, 9);
            calRunner.OnResult += calRunner_OnResult;
            calRunner.Start();
        }