Exemplo n.º 1
0
        /// <summary>
        /// Creates and initializes members.
        /// </summary>
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            gazeForm = new GazeForm();

            // Retreive underlying references to ActiveX controls
            tetTrackStatus = (ITetTrackStatus)axTetTrackStatus.GetOcx();
            tetCalibPlot   = (ITetCalibPlot)axTetCalibPlot.GetOcx();

            // Set up the calibration procedure object and it's events
            tetCalibProc = new TetCalibProcClass();
            _ITetCalibProcEvents_Event tetCalibProcEvents = (_ITetCalibProcEvents_Event)tetCalibProc;

            tetCalibProcEvents.OnCalibrationEnd += new _ITetCalibProcEvents_OnCalibrationEndEventHandler(tetCalibProcEvents_OnCalibrationEnd);
            tetCalibProcEvents.OnKeyDown        += new _ITetCalibProcEvents_OnKeyDownEventHandler(tetCalibProcEvents_OnKeyDown);

            // Set up the TET client object and it's events
            tetClient = new TetClientClass();
            _ITetClientEvents_Event tetClientEvents = (_ITetClientEvents_Event)tetClient;

            tetClientEvents.OnTrackingStarted += new _ITetClientEvents_OnTrackingStartedEventHandler(tetClientEvents_OnTrackingStarted);
            tetClientEvents.OnTrackingStopped += new _ITetClientEvents_OnTrackingStoppedEventHandler(tetClientEvents_OnTrackingStopped);
            tetClientEvents.OnGazeData        += new _ITetClientEvents_OnGazeDataEventHandler(tetClientEvents_OnGazeData);

            serviceBrowser = new TetServiceBrowserClass();
            serviceBrowser.OnServiceAdded   += new _ITetServiceBrowserEvents_OnServiceAddedEventHandler(serviceBrowser_OnServiceAdded);
            serviceBrowser.OnServiceUpdated += new _ITetServiceBrowserEvents_OnServiceUpdatedEventHandler(serviceBrowser_OnServiceUpdated);
            serviceBrowser.OnServiceRemoved += new _ITetServiceBrowserEvents_OnServiceRemovedEventHandler(serviceBrowser_OnServiceRemoved);
            serviceBrowser.Start();
        }
Exemplo n.º 2
0
        TetClient tetClient;                                 //Tobii Eye Tracking client


        #endregion

        public GazeAugmentedPuzzle()
        {
            InitializeComponent();

            GazeAgumentedButton.DwellTimeDuration = 500;
            _numRows = 3; //default _numRows value

            //TETCOMP
            tetClient = new TetClientClass();
            _ITetClientEvents_Event tetClientEvents = (_ITetClientEvents_Event)tetClient;

            tetClientEvents.OnGazeData += new _ITetClientEvents_OnGazeDataEventHandler(TetClientEvent_OnGazeData);


            #region INITIALIZE STATIC CANVASES AND HOSTINGPANEL
            //Main window canvas
            _hitCanvas        = new Canvas();
            _hitCanvas.Width  = 1280;   //1280 //in tobii
            _hitCanvas.Height = 1024;   //1024 //in tobii
            //Canvas.SetLeft(_hitCanvas, 0);
            //Canvas.SetTop(_hitCanvas, 0);
            this.AddChild(_hitCanvas);

            _puzzleHostingPanel        = new StackPanel();
            _puzzleHostingPanel.Margin = new Thickness(100);
            Canvas.SetLeft(_puzzleHostingPanel, 200);
            Canvas.SetTop(_puzzleHostingPanel, 50);
            _hitCanvas.Children.Add(_puzzleHostingPanel);


            //gaze point timer
            gazePointTimer           = new DispatcherTimer();
            gazePointTimer.IsEnabled = true;
            gazePointTimer.Interval  = new TimeSpan(0, 0, 0, 0, 100);
            gazePointTimer.Tick     += new EventHandler(gazePointTimer_Tick);

            //Initialize the gazepoint array and set the initial capacity to 5
            _gazePoint       = new Point();
            _smoothGazePoint = new Point();

            //Mouse pointer text block
            tbMouse      = new TextBlock();
            tbMouse.Text = "0";
            Canvas.SetTop(tbMouse, 0);
            Canvas.SetLeft(tbMouse, 0);
            _hitCanvas.Children.Add(tbMouse);


            //***********TRANSPARENT LAYER*************\\
            _transCanvas            = new Canvas();
            _transCanvas.Background = Brushes.Transparent;
            _transCanvas.Width      = _hitCanvas.Width;
            _transCanvas.Height     = _hitCanvas.Height;
            Canvas.SetLeft(_transCanvas, 0);
            Canvas.SetTop(_transCanvas, 0);
            _hitCanvas.Children.Add(_transCanvas);

            #endregion
        }