예제 #1
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            int usePort = Properties.Settings.Default.ServerPort;

            if (!NetworkUtil.IsPortAvailable(usePort))
            {
                usePort = NetworkUtil.GetOpenPort(Globals.ServerDefaultPort);
            }
            server                 = new SocketServer(false, usePort);
            server.OnConnected    += Server_OnAddedConnection;
            server.OnDisconnected += Server_OnDisconnected;
            server.OnError        += Server_OnError;

            IpTextBox.Text = NetworkUtil.GetIp().ToString();
            PortInput.Text = usePort.ToString();

            leapReader                = new LeapReader(true);
            leapReader.Device        += LeapController_Device;
            leapReader.Connect       += LeapController_Connect;
            leapReader.DeviceLost    += LeapController_DeviceLost;
            leapReader.DeviceFailure += LeapController_DeviceFailure;

            LogTextbox.Text = logStartText + "\r\nLog " + DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss");

            leapReader.StartConnection();

            StartServerButton.Text = ServerButtonStart;
            UpdateLabel(ConnectionLabel, ConnectionNone);

            AutoStartServerToggle.Checked = Properties.Settings.Default.AutoStartServer;
            if (AutoStartServerToggle.Checked)
            {
                ServerSwitch(true);
            }
        }
예제 #2
0
        public LeapReader(bool hmdOptimized = true)
        {
            SetPolicy(PolicyFlag.POLICY_BACKGROUND_FRAMES);
            SetPolicy(hmdOptimized ? PolicyFlag.POLICY_OPTIMIZE_HMD : PolicyFlag.POLICY_DEFAULT);
            if (hmdOptimized)
            {
                limitedHandCount = 2;
            }
            FrameReady += DataReady;

            if (Default != null)
            {
                Default = this;
            }
        }