private void GazeTrackerUIMainWindow_ContentRendered(object sender, EventArgs e)
        {
            // Load GTSettings
            Settings.Instance.LoadLatestConfiguration();
            GTHardware.Cameras.Thorlabs.ThorlabCamera c;
            // Camera initialization and start frame grabbing
            if (GTHardware.Camera.Instance.DeviceType != GTHardware.Camera.DeviceTypeEnum.None)
            {
                // If DirectShow camera, init using saved settings
                if (GTHardware.Camera.Instance.DeviceType == GTHardware.Camera.DeviceTypeEnum.DirectShow)
                {
                    GTHardware.Camera.Instance.SetDirectShowCamera(GTSettings.Settings.Instance.Camera.DeviceNumber, GTSettings.Settings.Instance.Camera.DeviceMode);
                }
                if (GTHardware.Camera.Instance.DeviceType == GTHardware.Camera.DeviceTypeEnum.Thorlabs)
                {
                    c = (GTHardware.Cameras.Thorlabs.ThorlabCamera)GTHardware.Camera.Instance.Device;
                    c.Settings.ReadAndApplyNativeIni("C:\\Users\\Nicola\\Documents\\Visual Studio 2012\\Projects\\GT 2.0\\Debug\\uc480.ini");
                }
                else
                {
                    GTHardware.Camera.Instance.Device.Initialize();
                }

                GTHardware.Camera.Instance.Device.Start();
            }
            else
            {
                // No camera detected, display message and quit
                ShowMessageNoCamera();
                //this.Close();
                //return;
            }

            // Create Tracker
            //tracker = new Tracker(GTCommands.Instance); // Hook up commands and events to tracker

            SettingsWindow.Instance.Title = "SettingsWindow"; // Just touch it..


            // Video preview window (tracker draws visualization)
            videoImageControl.Start();

            // Events
            RegisterEventListners();

            // Start servers
            tcpipServer.Start();
            Tracker.Instance.Server.IsEnabled = GTSettings.Settings.Instance.Network.UDPServerEnabled;


            // Register event listners for incoming TCP/IP commands
            RegisterForIncomingServerRequests();

            // Show window
            Show();

            // Set this process to real-time priority
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
        }
        private void GTApplicationMainWindow_ContentRendered(object sender, EventArgs e)
        {
            // Load GTSettings
            Settings.Instance.LoadLatestConfiguration();

            // Camera initialization and start frame grabbing
            if (GTHardware.Camera.Instance.DeviceType != GTHardware.Camera.DeviceTypeEnum.None)
            {
                // If DirectShow camera, init using saved settings
                if (GTHardware.Camera.Instance.DeviceType == GTHardware.Camera.DeviceTypeEnum.DirectShow)
                {
                    GTHardware.Camera.Instance.SetDirectShowCamera(GTSettings.Settings.Instance.Camera.DeviceNumber, GTSettings.Settings.Instance.Camera.DeviceMode);
                }
                else
                {
                    GTHardware.Camera.Instance.Device.Initialize();
                }

                GTHardware.Camera.Instance.Device.Start();
            }
            else
            {
                // No camera detected, display message and quit
                ShowMessageNoCamera();
                //this.Close();
                //return;
            }

            // Create Tracker
            //tracker = new Tracker(GTCommands.Instance); // Hook up commands and events to tracker

            SettingsWindow.Instance.Title = "SettingsWindow"; // Just touch it..


            // Video preview window (tracker draws visualization)
            videoImageControl.Start();

            // Events
            RegisterEventListners();

            // Start servers
            tcpipServer.Start();
            Tracker.Instance.Server.IsEnabled = GTSettings.Settings.Instance.Network.UDPServerEnabled;


            // Register event listners for incoming TCP/IP commands
            RegisterForIncomingServerRequests();

            menuBarIcons.IsSettingsVisible = false;

            // Show window
            Show();

            // Set this process to real-time priority
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
        }
Esempio n. 3
0
        private void GazeTrackerUIMainWindow_ContentRendered(object sender, EventArgs e)
        {
            // Load GTSettings
            //ShowMessageNoCamera();
            Settings.Instance.LoadLatestConfiguration();

            // Camera initialization and start frame grabbing
            if (GTHardware.Camera.Instance.DeviceType != GTHardware.Camera.DeviceTypeEnum.None)
            {
                // If DirectShow camera, init using saved settings
                if (GTHardware.Camera.Instance.DeviceType == GTHardware.Camera.DeviceTypeEnum.DirectShow)
                {
                    GTHardware.Camera.Instance.SetDirectShowCamera(GTSettings.Settings.Instance.Camera.DeviceNumber, GTSettings.Settings.Instance.Camera.DeviceMode);
                }
                else
                {
                    GTHardware.Camera.Instance.Device.Initialize();
                }

                GTHardware.Camera.Instance.Device.Start();
            }
            else
            {
                // No camera detected, display message and quit
                ShowMessageNoCamera();
                //this.Close();
                //return;
            }

            // Create Tracker
            //tracker = new Tracker(GTCommands.Instance); // Hook up commands and events to tracker

            #region EyeSpark specific code

            if (HeadTracker.Instance.ConnectToDevice())
            {
                HeadTracker.Instance.HeadMovement +=
                    new HeadMovementEventHandler(HandleHeadMovement);

                // TODO: [EyeSpark] consider removing
                HeadTracker.Instance.Start();
            }
            else
            {
                Console.WriteLine("WARNING: Failed to start head tracker");
                //this.AppClose();
            }

            #endregion

            SettingsWindow.Instance.Title = "SettingsWindow"; // Just touch it..


            // Video preview window (tracker draws visualization)
            videoImageControl.Start();

            // Events
            RegisterEventListners();

            // Start servers
            tcpipServer.Start();
            Tracker.Instance.Server.IsEnabled = GTSettings.Settings.Instance.Network.UDPServerEnabled;


            // Register event listners for incoming TCP/IP commands
            RegisterForIncomingServerRequests();

            menuBarIcons.IsSettingsVisible = false;

            // Show window
            Show();

            // Set this process to real-time priority
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
        }
Esempio n. 4
0
 private void button3_Click(object sender, EventArgs e)
 {
     xxxx = new TCPIPServer(2000, "ThomasPeng");
     xxxx.Start();
 }