public void StartEyeTracking() { using (var eyeXHost = new EyeXHost()) { // Create a data stream: lightly filtered gaze point data. // Other choices of data streams include EyePositionDataStream and FixationDataStream. using (var fixationGazeDataStream = eyeXHost.CreateFixationDataStream(FixationDataMode.Slow)) { // Start the EyeX host. eyeXHost.Start(); eyeXHost.EyeTrackingDeviceStatusChanged += EyeXHost_EyeTrackingDeviceStatusChanged; eyeXHost.UserPresenceChanged += EyeXHost_UserPresenceChanged; //eyeXHost.CreateEyePositionDataStream double smoothX = 0; double smoothY = 0; double box = 35; // Write the data to the console. fixationGazeDataStream.Next += (s, e) => { if (e.X > smoothX + box || e.X < smoothX - box || e.Y > smoothY + box || e.Y < smoothY - box) { Cursor.Position = new Point(Convert.ToInt32(e.X), Convert.ToInt32(e.Y)); smoothX = e.X; smoothY = e.Y; } else { Cursor.Position = new Point(Convert.ToInt32(smoothX), Convert.ToInt32(smoothY)); } }; while (cantStopDontStop) { Thread.Sleep(1000); } } } }
public MainEngine() { sharedData = SharedDataSingleton.Instance(); _settingsList = SettingsSingleton.Instance(); inputSimulator = sharedData.inputSimulator; controlState = new ControlContext(); controlState.changedState += StateChanged; controlState.ControlState = new CommandState(inputSimulator, controlState); //System.Diagnostics.Process.Start("C:/Program Files (x86)/Nuance/NaturallySpeaking13/Program/natspeak.exe"); SetupSpeechRecognition(); //Instantiating and starting the eye tracker host eyex = new EyeXHost(); eyex.CreateFixationDataStream(FixationDataMode.Sensitive).Next += (s, e) => Fixation(e.EventType, (int)e.X, (int)e.Y, e.Timestamp); eyex.Start(); }
protected EventSingleton() { //Setting up and starting the timers updateTimer.Interval = UPDATEINTERVAL; updateTimer.Start(); drawTimer.Interval = DRAWINTERVAL; drawTimer.Start(); //keyboardHook = new Hook("Global Action Hook"); //systemHook = new Hook(); fixationEvent += EventSingleton_fixationEvent; //Instantiating and starting the eye tracker host eyex = new EyeXHost(); eyex.CreateFixationDataStream(FixationDataMode.Sensitive).Next += (s, e) => fixationEvent(CreateFixation(e.EventType, (int)e.X, (int)e.Y)); eyex.Start(); }
public void StartServer() { this.eyeXHost = new EyeXHost(); this.eyeXHost.Start(); this.gazeDataStream = eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered); this.gazeDataStream.Next += new System.EventHandler<EyeXFramework.GazePointEventArgs>(this.HandleEyeGazeEvent); this.fixationDataStream = eyeXHost.CreateFixationDataStream(FixationDataMode.Slow); this.fixationDataStream.Next += new System.EventHandler<EyeXFramework.FixationEventArgs>(this.HandleEyeFixationEvent); try { IPAddress ipAddr = IPAddress.Parse(host); tcpServer = new TcpClient(); tcpServer.Connect(ipAddr, port); swSender = new StreamWriter(tcpServer.GetStream()); } catch { this.StopServer(); } }