示例#1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            _host = new Host();
            _wpfInteractorAgent = _host.InitializeWpfAgent();
            base.OnStartup(e);

            MainWindow window = new MainWindow();

            Application.Current.MainWindow.WindowState = WindowState.Maximized;

            // Create the ViewModel to which
            // the main window binds.
            string path      = "Data/scenario.xml";
            var    viewModel = new MainWindowViewModel(path);

            // When the ViewModel asks to be closed,
            // close the window.
            EventHandler handler = null;

            handler = delegate
            {
                viewModel.RequestClose -= handler;
                window.Close();
            };
            viewModel.RequestClose += handler;

            // Allow all controls in the window to
            // bind to the ViewModel by setting the
            // DataContext, which propagates down
            // the element tree.
            window.DataContext = viewModel;

            window.Show();
        }
        /**
         *
         * This method is used to calibrate at the start of the screen when 5 circular dots are displayed
         */
        protected void calibrate(object sender, MouseButtonEventArgs e)
        {
            // get x and y
            int                x = 0, y = 0;
            Ellipse            elp                 = e.Source as Ellipse;
            int                orgX                = (int)Canvas.GetLeft(elp);;
            int                orgY                = (int)Canvas.GetTop(elp);;
            Host               caliHost            = new Host();
            WpfInteractorAgent caliAgent           = caliHost.InitializeWpfAgent();
            var                gazePointDataStream = caliHost.Streams.CreateGazePointDataStream();

            gazePointDataStream.GazePoint((gazePointX, gazePointY, timeStamp) =>
            {
                x = (int)gazePointX;
                y = (int)gazePointY;
            });
            Thread.Sleep(100);
            Xoffset        = Xoffset + x - orgX;
            Yoffset        = Yoffset + y - orgY;
            elp.Visibility = Visibility.Hidden;
            if (count == 5)
            {
                button.Visibility    = Visibility.Visible;
                TextBlock.Visibility = Visibility.Visible;
                Console.WriteLine("Final X Offset - " + Xoffset / 5);
                Console.WriteLine("Final Y Offset - " + Yoffset / 5);
            }
            caliHost.Dispose();
            count++;
        }
示例#3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            _host = new Host();
            _wpfInteractorAgent = _host.InitializeWpfAgent();

            gazePointDataStream = _host.Streams.CreateGazePointDataStream();
        }
示例#4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // Everything starts with initializing Host, which manages connection to the
            // Tobii Engine and provides all Tobii Core SDK functionality.
            // NOTE: Make sure that Tobii.EyeX.exe is running
            _host = new Host();

            // We need to instantiate InteractorAgent so it could control lifetime of the interactors.
            _agent = _host.InitializeWpfAgent();
        }
示例#5
0
 protected override void OnStartup(StartupEventArgs e)
 {
     _host = new Host();
     _wpfInteractorAgent = _host.InitializeWpfAgent();
     window = new MainWindow();
     window.Show();
     wH = (int)window.Height;
     wW = (int)window.Width;
     window.set_host(_host);
     window.set_wpfInteractorAgent(_wpfInteractorAgent);
 }
示例#6
0
        public GazeHandler()
        {
            _host = new Host();
            _wpfInteractorAgent = _host.InitializeWpfAgent();

            _gazePointDataStream = _host.Streams.CreateGazePointDataStream();
            _fixationDataStream  = _host.Streams.CreateFixationDataStream();

            _fixationDataStream.Subscribe(this);
            _gazePointDataStream.Subscribe(this);
        }
示例#7
0
        public MainWindow mainWindow;         // obviously the window containing our main menu

        protected override void OnStartup(StartupEventArgs e)
        {
            _host = new Host();
            _wpfInteractorAgent = _host.InitializeWpfAgent(); // code necessary to use Tobii. See note above.

            // Creating and displaying our two windows. We do not use StartupURI in App.xaml to start up either window.
            // This is because our FloatingIconWindow needs access to the MainWindow,
            // which only seems possible if I can pass the MainWindow as a parameter in the constructor for FloatingIconWindow
            mainWindow = new MainWindow();
            mainWindow.Show();
            mainPopup = new FloatingIconWindow(mainWindow);
            mainWindow.GetFloatingIconWindow(mainPopup);
            mainPopup.Show();
        }
        public void Connect()
        {
            if (!_isConnected)
            {
                _TobiiHost.EnableConnection();
                _TobiiWPFAgent = _TobiiHost.InitializeWpfAgent();

                _GazePointDataStream       = _TobiiHost.Streams.CreateGazePointDataStream(Tobii.Interaction.Framework.GazePointDataMode.Unfiltered);
                _GazePointDataStream.Next += OnGazePointData;
                _FixationDataStream        = _TobiiHost.Streams.CreateFixationDataStream();
                _FixationDataStream.Next  += OnFixationData;
                _EyePositionStream         = _TobiiHost.Streams.CreateEyePositionStream(true);
                _EyePositionStream.Next   += OnEyePositionData;
                _isConnected = true;
            }
        }
示例#9
0
 protected override void OnStartup(StartupEventArgs e)
 {
     _hostemail = new Host();
     _wpfInteractorAgentemail = _hostemail.InitializeWpfAgent();
 }
        private WpfInteractorAgent _agent; // Controls lifetime of the interactors


        // Application starts with initializing _host, and _agent
        protected override void OnStartup(StartupEventArgs e)
        {
            _host  = new Host();
            _agent = _host.InitializeWpfAgent();
        }
 public void set_wpfInteractorAgent(WpfInteractorAgent wia)
 {
     this._wpfInteractorAgent = wia;
 }
示例#12
0
        protected override void OnStartup(StartupEventArgs e)
        {
            StaticServer.instance.CheckUpdateAsync();

            var options = new Options();

            Parser.Default.ParseArguments <Options>(e.Args)
            .WithParsed <Options>(o =>
            {
                if (o.IsEditor)
                {
                    _isEditor = o.IsEditor;
                }
                if (o.Path != null)
                {
                    _path = o.Path;
                }
            });


            // Создать директорию для временных файлов
            _tempDirPath = Path.GetTempPath() + "\\linka.looks\\temp\\";
            Directory.CreateDirectory(_tempDirPath);

            // TODO: Заменить на загрузку из конфига
            _yandexSpeech = new YandexSpeech("4e68a4e5-b590-448d-9a66-f3d8f2854348", _tempDirPath);

            // Everything starts with initializing Host, which manages connection to the
            // Tobii Engine and provides all Tobii Core SDK functionality.
            // NOTE: Make sure that Tobii.EyeX.exe is running
            _host = new Host();

            // We need to instantiate InteractorAgent so it could control lifetime of the interactors.
            _agent = _host.InitializeWpfAgent();

            // Загрузка настроек из файла
            var configFile     = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\linka.looks.config.json";
            var settingsLoader = new SettingsLoader();

            if (File.Exists(configFile) == true)
            {
                _settings = settingsLoader.LoadFromFile(configFile);
            }
            else
            {
                // Файла не существует, установим настройки по умолчанию
                _settings = new Settings();

                _settings.ConfigFilePath = configFile;

                _settings.Keys = new Dictionary <string, string>();
                _settings.Keys.Add("Left", "MoveSelectorLeft");
                _settings.Keys.Add("Right", "MoveSelectorRight");
                _settings.Keys.Add("Up", "MoveSelectorUp");
                _settings.Keys.Add("Down", "MoveSelectorDown");
                _settings.Keys.Add("Return", "Enter");
                _settings.Keys.Add("Space", "Enter");

                _settings.IsHasGazeEnabled       = true;
                _settings.IsAnimatedClickEnabled = true;
                _settings.ClickDelay             = 1;
                _settings.IsPlayAudioFromCard    = false;
                _settings.IsPageButtonVisible    = true;
                _settings.IsJoystickEnabled      = true;
                _settings.IsKeyboardEnabled      = true;
                _settings.IsMouseEnabled         = true;

                settingsLoader.SaveToFile(configFile, _settings);
            }

            _settings.SettingsLoader = settingsLoader;
            _settings.TempDirPath    = _tempDirPath;
            _settings.YandexSpeech   = _yandexSpeech;
            _settings.Host           = _host;

            if (_isEditor == true)
            {
                ShowEditorWindow(_path);
            }
            else
            {
                ShowMainWindow(_path);
            }
        }
示例#13
0
 public void initHost()
 {
     _host  = new Host();
     _agent = _host.InitializeWpfAgent();
 }
示例#14
0
 protected override void OnStartup(StartupEventArgs e)
 {
     TobiiHost          = new Host();
     WpfInteractorAgent = TobiiHost.InitializeWpfAgent();
 }