public VolkeTestOrchestrator(Form parentForm, BoardControl boardControl, VolkeTest test, int idParticipant, Sensors.SensorContainer sensors) : base(parentForm, boardControl) { this.test = test; this.testItems = test.Items.GetEnumerator(); this.idParticipant = idParticipant; this.sensors = sensors; }
public SpectatorServer(Board board, Sensors.SensorContainer sensors = null) { ServerDiscovery.StartListening(); this.board = board; this.sensors = sensors; listenerThread = new Thread(StartListening) { IsBackground = true }; listenerThread.Start(); }
public TestContainer StartTest(Participant participant) { this.currentParticipant = participant; var mouseSensor = new Sensors.MouseSensor(this.boardControl); var eyeTrackerSensor = new Sensors.TobiiEyeTracker.EyeTrackerSensor(this.boardControl); var sensorContainer = new Sensors.SensorContainer(mouseSensor, eyeTrackerSensor); var test = this.tests[0]; var orchestrator = test.GetOrchestrator(this.sidePlayer, this.boardControl, this.currentParticipant.Id, sensorContainer); orchestrator.Finished += (sender, result) => { currentParticipant.Tests.Add(result); this.ShowTest(int.MaxValue); }; orchestrator.Start(); return new TestContainer(orchestrator, sensorContainer); }
public void StartInternal() { int moves = test.PlayerMoves; if (moves == 0) moves = int.MaxValue; var board = this.BoardControl.StartNew(test.GetPlayer(PlayerColor.White), test.GetPlayer(PlayerColor.Black), test.FEN); var mouseSensor = new Sensors.MouseSensor(this.BoardControl); this.sensorContainer = new Sensors.SensorContainer(mouseSensor, new Sensors.TobiiEyeTracker.EyeTrackerSensor(this.BoardControl)); this.fileName = "recorded-files\\" + Guid.NewGuid() + ".chess"; this.writer = new IO.ChessStreamWriter(board, sensorContainer, fileName); board.PieceMoved += move => { if (board.CurrentPlayer.PlayerColor == PlayerColor.White) return; moves--; if (moves == 0) this.Finish(board); }; board.Start(); this.stopWatch = System.Diagnostics.Stopwatch.StartNew(); }
public CurrentTest(VolkeTestItem test, BoardControl boardControl, DateTime questionDate, DateTime startDate, DateTime overallStartDate) { this.StartDate = startDate; this.QuestionDate = questionDate; this.overallStartDate = overallStartDate; this.Stopwatch = System.Diagnostics.Stopwatch.StartNew(); this.Test = test; var board = boardControl.StartNew(new Player(), new Player(), test.FEN); //var mouseSensor = new Sensors.MouseSensor(boardControl); this.RecordFile = "recorded-files\\" + Guid.NewGuid() + ".chess"; this.sensorContainer = new Sensors.SensorContainer(); this.writer = new IO.ChessStreamWriter(board, sensorContainer, this.RecordFile); }
private void newGameToolStripMenuItem_Click(object sender, EventArgs e) { var config = NewGameForm.Show(this); if (config == null) return; if (spectatorServer != null) ((IDisposable)spectatorServer).Dispose(); var board = this.boardControl.StartNew(config.White, config.Black); var mouseSensor = new Sensors.MouseSensor(this.boardControl); var eyeTrackerSensor = new Sensors.TobiiEyeTracker.EyeTrackerSensor(this.boardControl); var sensorContainer = new Sensors.SensorContainer(mouseSensor, eyeTrackerSensor); var output = new ProxiedMemoryStream(File.Create(DateTime.Now.ToString("yyyMMddmmss") + ".chess")); spectatorServer = new SpectatorServer(board, sensorContainer); var writer = new IO.ChessStreamWriter(board, sensorContainer, output); if (config.White.IsReady && config.Black.IsReady) board.Start(); else this.boardControl.ShowMessage("Waiting for remote player", board.Start, () => config.White.IsReady && config.Black.IsReady); }