示例#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();
        }
示例#2
0
        private void LoadTrackStatusObject()
        {
            this.axTetTrackStatus = new AxTetComp.AxTetTrackStatus();

            this.axTetTrackStatus.Enabled  = true;
            this.axTetTrackStatus.Name     = "axTetTrackStatus";
            this.axTetTrackStatus.OcxState = ((System.Windows.Forms.AxHost.State)(Resources.FindName("axTetTrackStatus.OcxState")));

            //used to host System.Windows.Forms control in WPF
            System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
            host.Child  = axTetTrackStatus; //add the trackstatus window to the host
            host.Width  = 120;              //Size of the host controls the size of the control
            host.Height = 70;
            Canvas.SetBottom(host, 5);      //position the host on Canvas_TrackStatus
            Canvas.SetRight(host, 10);
            //this.Canvas_TrackStatus.Children.Add(host); // add the host to the track status canvas
            _hitCanvas.Children.Add(host);

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

            //*** try to contect to the server

            try
            {
                // Connect to the TET server if necessary
                if (!tetTrackStatus.IsConnected)
                {
                    tetTrackStatus.Connect("193.167.42.30", (int)TetConstants.TetConstants_DefaultServerPort);
                }

                // Start the track status meter
                if (!tetTrackStatus.IsTracking)
                {
                    tetTrackStatus.Start();
                }

                //Connect to the TET Client if necessary
                if (!tetClient.IsConnected)
                {
                    tetClient.Connect("193.167.42.30", (int)TetConstants.TetConstants_DefaultServerPort, TetSynchronizationMode.TetSynchronizationMode_Server);
                }
                tetClient.StartTracking(); //Start tracking
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void LoadTrackStatusObject()
        {
            this.axTetTrackStatus = new AxTetComp.AxTetTrackStatus();

             this.axTetTrackStatus.Enabled = true;
             this.axTetTrackStatus.Name = "axTetTrackStatus";
             this.axTetTrackStatus.OcxState = ((System.Windows.Forms.AxHost.State)(Resources.FindName("axTetTrackStatus.OcxState")));

             //used to host System.Windows.Forms control in WPF
             System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
             host.Child = axTetTrackStatus; //add the trackstatus window to the host
             host.Width = 120;       //Size of the host controls the size of the control
             host.Height = 70;
             Canvas.SetBottom(host, 5);      //position the host on Canvas_TrackStatus
             Canvas.SetRight(host, 10);
             //this.Canvas_TrackStatus.Children.Add(host); // add the host to the track status canvas
             _hitCanvas.Children.Add(host);

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

             //*** try to contect to the server

             try
             {
                 // Connect to the TET server if necessary
                 if (!tetTrackStatus.IsConnected) tetTrackStatus.Connect("193.167.42.30", (int)TetConstants.TetConstants_DefaultServerPort);

                 // Start the track status meter
                 if (!tetTrackStatus.IsTracking) tetTrackStatus.Start();

                 //Connect to the TET Client if necessary
                 if (!tetClient.IsConnected)
                 {
                     tetClient.Connect("193.167.42.30", (int)TetConstants.TetConstants_DefaultServerPort, TetSynchronizationMode.TetSynchronizationMode_Server);
                 }
                 tetClient.StartTracking();//Start tracking
             }
             catch (Exception ex)
             {

                 MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             }
        }