Not possible to pass command line arguments to the Eyetribe UI. I'm not sure it makes sense to make it so. For me a better approach is to have a small executable to just do the specific task. Since it's a happy Friday, here is the
SimpleCalibrator.
Download the
Visual Studio project or go straight to the
binary executable.
The application is simple. It uses the TETControls to do a calibration with the CalibrationRunner. It will look for command line arguments to specify the size and number of points.
It would be started like this:
- Code: Select all
SimpleCalibrator.exe width=1000 height=800 numpoints=9
The complete code looks like this:
- Code: Select all
using System.Windows;
using System.Windows.Forms;
using System.Windows.Interop;
using TETCSharpClient;
using TETControls.Calibration;
using MessageBox = System.Windows.MessageBox;
using Size = System.Drawing.Size;
namespace SimpleCalibrator
{
public partial class MainWindow : Window
{
private Screen screen;
private Size area;
private int numPoints = 9;
public MainWindow()
{
GazeManager.Instance.Activate(GazeManager.ApiVersion.VERSION_1_0, GazeManager.ClientMode.Push);
InitializeComponent();
if (!GazeManager.Instance.IsConnected)
{
MessageBox.Show("EyeTribe Server has not been started");
Close();
}
Calibrate();
GazeManager.Instance.Deactivate();
Close();
}
private void Calibrate()
{
//Run the calibration on 'this' monitor, default to full screen nine points
screen = Screen.FromHandle(new WindowInteropHelper(this).Handle);
area = new Size(screen.Bounds.Width, screen.Bounds.Height);
ParseArguments();
// Run the calibration
CalibrationRunner calRunner = new CalibrationRunner(screen, area, numPoints);
calRunner.Start();
}
private void ParseArguments()
{
foreach (string s in App.args)
{
if (string.IsNullOrEmpty(s))
continue;
string[] keyVal = s.Split('=');
if (keyVal.Length < 2)
continue;
string keyStr = keyVal[0];
string valueStr = keyVal[1];
int value = 0;
int.TryParse(valueStr, out value);
if(string.IsNullOrEmpty(keyStr) || value == 0)
continue;
switch (keyStr)
{
case "width":
if(value < screen.Bounds.Width)
area.Width = value;
break;
case "height":
if(value < screen.Bounds.Height)
area.Height = value;
break;
case "numpoints":
if(value == 9 || value == 12 || value == 16)
numPoints = value;
break;
}
}
}
}
}
It's of course possible to extend the number of parameters (e.g. point color etc.). These are all properties of the CalibrationRunner class.