protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); // Start EyeXHost _eyeXHost = new WpfEyeXHost(); //_eyeXHost.Start(); // Setup Unity Container _container = new UnityContainer(); RegisterSingleton <IMainWindow, MainWindow>(); RegisterServices(); // Set up Microsoft Service Locator to use Unity // Service instances can be requested using ServiceLocator.Current.GetInstance<Type>() ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(_container)); // Run main window and open initial page var mainWindow = _container.Resolve <MainWindow>(); mainWindow.Show(); mainWindow.SetPage(new Uri("Views/HubView.xaml", UriKind.Relative)); #if DEBUG mainWindow.Title += " (DEBUG MODE) - Be sure to build in release mode for use"; #endif }
public MainWindowModel() { IsUserPresent = false; IsTrackingGaze = false; IsTrackingGazeSupported = true; // Create and start the WpfEyeXHost. Starting the host means // that it will connect to the EyeX Engine and be ready to // start receiving events and get the current values of // different engine states. In this sample we will be using // the UserPresence engine state. _eyeXHost = new WpfEyeXHost(); // Register an status-changed event listener for UserPresence. // NOTE that the event listener must be unregistered too. This is taken care of in the Dispose(bool) method. _eyeXHost.UserPresenceChanged += EyeXHost_UserPresenceChanged; _eyeXHost.GazeTrackingChanged += EyeXHost_GazeTrackingChanged; // Start the EyeX host. _eyeXHost.Start(); // Wait until we're connected. if (_eyeXHost.WaitUntilConnected(TimeSpan.FromSeconds(5))) { // Make sure the EyeX Engine version is equal to or greater than 1.4. var engineVersion = _eyeXHost.GetEngineVersion().Result; if (engineVersion.Major != 1 || engineVersion.Major == 1 && engineVersion.Minor < 4) { IsTrackingGazeSupported = false; } } }
public Keyboard() { InitializeComponent(); eyeXHost = new WpfEyeXHost(); eyeXHost.Start(); inputBox.Focus(); }
public App() { // file = new System.IO.StreamWriter("c:\\testdata\\test.txt", true); _eyeXHost = new WpfEyeXHost(); _eyeXHost.Start(); // Create a data stream: lightly filtered gaze point data. // Other choices of data streams include EyePositionDataStream and FixationDataStream. /* using (var lightlyFilteredGazeDataStream = _eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered)) * { * lightlyFilteredGazeDataStream.Next += gazeCallback;// Console.WriteLine("Gaze point at ({0:0.0}, {1:0.0}) @{2:0} ", e.Timestamp, e.X, e.Y); * }*/ }
private WpfEyeXChest() { _eyeXHost = new WpfEyeXHost(); eyePositionListener = blinkProcessor; var eyePositionStream = _eyeXHost.CreateEyePositionDataStream(); eyePositionStream.Next += eyePositionNext; var gazePointStream = _eyeXHost.CreateGazePointDataStream(GazePointDataMode.Unfiltered); gazePointStream.Next += gazePointNext; }
/// <summary> /// Initializes the EyeXHost, creates an Output directory, and loads the images based on the input folder name. /// </summary> public MainWindow() { _eyeXHost = new WpfEyeXHost(); _eyeXHost.Start(); InitializeComponent(); gazeDataTextX.DataContext = publicGazeData; gazeDataTextY.DataContext = publicGazeData; gazeDataTextTime.DataContext = publicGazeData; var stream = _eyeXHost.CreateGazePointDataStream(Tobii.EyeX.Framework.GazePointDataMode.LightlyFiltered); string exeRuntimeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); outputFileDirectory = Path.Combine(exeRuntimeDirectory, "Output"); if (!System.IO.Directory.Exists(outputFileDirectory)) { // Output directory does not exist, so create it. System.IO.Directory.CreateDirectory(outputFileDirectory); } Console.WriteLine(exeRuntimeDirectory); Console.WriteLine(outputFileDirectory); var CSVDialog = new SaveCSVFile(); if (CSVDialog.ShowDialog() == true) { outputFileName = CSVDialog.ResponseText; } var batchDialog = new InputBatch(); if (batchDialog.ShowDialog() == true) { batchName = batchDialog.ResponseText; } File.WriteAllText(outputFileDirectory + @"\" + outputFileName + ".csv", "X Gaze Data, Y Gaze Data, Time \r\n"); stream.Next += (s, e) => updateGazeData((int)e.X, (int)e.Y, (int)e.Timestamp); //Initialize Image control, Image directory path and Image timer. IntervalTimer = Convert.ToInt32(ConfigurationManager.AppSettings["IntervalTime"]); strImagePath = "Images/" + batchName; ImageControls = new[] { myImage, myImage2 }; LoadImageFolder(strImagePath); timerImageChange = new DispatcherTimer(); timerImageChange.Interval = new TimeSpan(0, 0, IntervalTimer); timerImageChange.Tick += new EventHandler(timerImageChange_Tick); }
public MainWindow() { _eyeXHost = new WpfEyeXHost(); _eyeXHost.Start(); InitializeComponent(); gazeDataTextX.DataContext = publicGazeData; gazeDataTextY.DataContext = publicGazeData; var fixationGazeDataStream = _eyeXHost.CreateFixationDataStream(FixationDataMode.Sensitive); fixationGazeDataStream.Next += (s, e) => updateFixationData(e); var stream = _eyeXHost.CreateEyePositionDataStream(); stream.Next += (s, e) => updateEyeData(e); }
public MainWindow() { _eyeXHost = new WpfEyeXHost(); _eyeXHost.Start(); InitializeComponent(); var stream = _eyeXHost.CreateGazePointDataStream(Tobii.EyeX.Framework.GazePointDataMode.LightlyFiltered); string exeRuntimeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); outputFileDirectory = Path.Combine(exeRuntimeDirectory, "Output"); if (!System.IO.Directory.Exists(outputFileDirectory)) { // Output directory does not exist, so create it. System.IO.Directory.CreateDirectory(outputFileDirectory); } Console.WriteLine(exeRuntimeDirectory); Console.WriteLine(outputFileDirectory); stream.Next += (s, e) => updateGazeData((int)e.X, (int)e.Y, (int)e.Timestamp); File.WriteAllText(outputFileDirectory + @"\gazeDataOutput.csv", "X Gaze Data, Y Gaze Data, Time \r\n"); writeDataToFile(_eyeXHost.ScreenBounds.ToString()); }
public App() { _eyeXHost = new WpfEyeXHost(); _eyeXHost.Start(); }
public App() { Autocomplete.WordPredictor.Test(); _eyeXHost = new WpfEyeXHost(); _eyeXHost.Start(); }
public App() { // Init Tobii hardware _eyeXHost = new WpfEyeXHost(); _eyeXHost.Start(); }
public MainWindowModel() { IsUserPresent = false; IsTrackingGaze = false; IsTrackingGazeSupported = true; _hasEyesClosed = false; // Create and start the WpfEyeXHost. Starting the host means // that it will connect to the EyeX Engine and be ready to // start receiving events and get the current values of // different engine states. In this sample we will be using // the UserPresence engine state. _eyeXHost = new WpfEyeXHost(); // Register an status-changed event listener for UserPresence. // NOTE that the event listener must be unregistered too. This is taken care of in the Dispose(bool) method. _eyeXHost.UserPresenceChanged += EyeXHost_UserPresenceChanged; _eyeXHost.GazeTrackingChanged += EyeXHost_GazeTrackingChanged; // GazePointDataStream lightlyFilteredGazeDataStream = _eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered); lightlyFilteredGazeDataStream.Next += (s, e) => { //Console.WriteLine("Gaze point at ({0:0.0}, {1:0.0}) @{2:0}", e.X, e.Y, e.Timestamp); _lastEvent = e; }; // TODO: make sure the app "magnifier" is running, or else the user has to restart pc if zoom breaks /* * * Process p = Process.Start("notepad.exe"); * p.WaitForInputIdle(); * IntPtr h = p.MainWindowHandle; * SetForegroundWindow(h); * SendKeys.SendWait("k"); */ MagInitialize(); const int SM_CXSCREEN = 0; const int SM_CYSCREEN = 1; _screenWidth = GetSystemMetrics(SM_CXSCREEN); _screenHeight = GetSystemMetrics(SM_CYSCREEN); Console.WriteLine("Screen {0}x{1}", _screenWidth, _screenHeight); // TODO maybe use virtual screen https://msdn.microsoft.com/en-us/library/windows/desktop/hh162714(v=vs.85).aspx // Start the EyeX host. _eyeXHost.Start(); // Wait until we're connected. if (_eyeXHost.WaitUntilConnected(TimeSpan.FromSeconds(5))) { // Make sure the EyeX Engine version is equal to or greater than 1.4. var engineVersion = _eyeXHost.GetEngineVersion().Result; if (engineVersion.Major != 1 || engineVersion.Major == 1 && engineVersion.Minor < 4) { IsTrackingGazeSupported = false; } } }