예제 #1
0
 private void timer_Tick(object sender, EventArgs e)
 {
     try
     {
         _tracker.Update();
         _button.Update();
     }
     catch (Exception exc)
     {
         Logger.Instance.Error(exc.Message, exc);
     }
 }
예제 #2
0
 /* Wiimote_Remote mainloop() */
 public WiimoteExtensionType Update()
 {
     anaRemote.Update();
     buttRemote.Update();
     if (parasitized)
     {
         return(WiimoteExtensionType.BALANCE_BOARD);
     }
     else
     {
         return(WiimoteExtensionType.WIIMOTE);
     }
 }
예제 #3
0
        static void Main(string[] args)
        {
            TrackerRemote tracker = new TrackerRemote("Tracker0@localhost");
            tracker.PositionChanged += new TrackerChangeEventHandler(PositionChanged);
            tracker.MuteWarnings = false;

            ButtonRemote button = new ButtonRemote("Button0@localhost");
            button.ButtonChanged += new ButtonChangeEventHandler(ButtonChanged);
            button.MuteWarnings = true;

            while (true)
            {
                tracker.Update();
                button.Update();
            }
        }
        static void Main(string[] args)
        {
            TrackerRemote tracker = new TrackerRemote("Tracker0@localhost");

            tracker.PositionChanged += new TrackerChangeEventHandler(PositionChanged);
            tracker.MuteWarnings     = false;

            ButtonRemote button = new ButtonRemote("Button0@localhost");

            button.ButtonChanged += new ButtonChangeEventHandler(ButtonChanged);
            button.MuteWarnings   = true;

            while (true)
            {
                tracker.Update();
                button.Update();
            }
        }
예제 #5
0
        private void RunNetworkKinect(string serverName, string rhServerName, string lhServerName)
        {
            using (TrackerRemote client = new TrackerRemote(serverName))
            {
                client.PositionChanged += client_PositionChanged;

                //Start the rh server, if needed
                if (rhServerName != null && lhServerName != null)
                {
                    if (rhServerName != null || lhServerName != null)
                    {
                        if (rhServerName != null)
                        {
                            //Only the right hand server should be used
                            using (ButtonRemote rhClient = new ButtonRemote(rhServerName))
                            {
                                rhClient.ButtonChanged += rhClient_ButtonChanged;
                                isRunning = true;

                                while (!forceStop)
                                {
                                    client.Update();
                                    rhClient.Update();
                                    Thread.Yield();
                                }

                                rhClient.ButtonChanged -= rhClient_ButtonChanged;
                            }
                        }
                        else
                        {
                            //Only the left hand server should be used
                            using (ButtonRemote lhClient = new ButtonRemote(lhServerName))
                            {
                                lhClient.ButtonChanged += lhClient_ButtonChanged;
                                isRunning = true;

                                while (!forceStop)
                                {
                                    client.Update();
                                    lhClient.Update();
                                    Thread.Yield();
                                }

                                lhClient.ButtonChanged -= lhClient_ButtonChanged;
                            }

                        }
                    }
                    else
                    {
                        if (rhServerName == lhServerName)
                        {
                            //The left and right hand should be used, but they are on the same server
                            using (ButtonRemote handClient = new ButtonRemote(rhServerName))
                            {
                                handClient.ButtonChanged += rhClient_ButtonChanged;
                                isRunning = true;

                                while (!forceStop)
                                {
                                    client.Update();
                                    handClient.Update();
                                    Thread.Yield();
                                }

                                handClient.ButtonChanged -= rhClient_ButtonChanged;
                            }
                        }
                        else
                        {
                            //Both the left and right hand should be used, and they are on different servers
                            using (ButtonRemote rhClient = new ButtonRemote(rhServerName))
                            {
                                using (ButtonRemote lhClient = new ButtonRemote(lhServerName))
                                {
                                    rhClient.ButtonChanged += rhClient_ButtonChanged;
                                    lhClient.ButtonChanged += lhClient_ButtonChanged;
                                    isRunning = true;

                                    while (!forceStop)
                                    {
                                        client.Update();
                                        rhClient.Update();
                                        lhClient.Update();
                                        Thread.Yield();
                                    }

                                    rhClient.ButtonChanged -= rhClient_ButtonChanged;
                                    lhClient.ButtonChanged -= lhClient_ButtonChanged;
                                }
                            }
                        }
                    }
                }
                else
                {
                    //No hand servers case
                    isRunning = true;

                    while (!forceStop)
                    {
                        client.Update();
                        Thread.Yield();
                    }
                }

                client.PositionChanged -= client_PositionChanged;
            }

            isRunning = false;
        }
예제 #6
0
 /*Remote mainloop() */
 public void Update()
 {
     buttRemote.Update();
 }
예제 #7
0
 /* Tracker_Remote mainloop() */
 public void Update()
 {
     trkRemote.Update();
     buttRemote.Update();
 }
예제 #8
0
 /* Mouse_Remote mainloop() */
 public void Update()
 {
     anaRemote.Update();
     buttRemote.Update();
 }
예제 #9
0
        private void RunNetworkKinect(string serverName, string rhServerName, string lhServerName)
        {
            using (TrackerRemote client = new TrackerRemote(serverName))
            {
                client.PositionChanged += client_PositionChanged;

                //Start the rh server, if needed
                if (rhServerName != null && lhServerName != null)
                {
                    if (rhServerName != null || lhServerName != null)
                    {
                        if (rhServerName != null)
                        {
                            //Only the right hand server should be used
                            using (ButtonRemote rhClient = new ButtonRemote(rhServerName))
                            {
                                rhClient.ButtonChanged += rhClient_ButtonChanged;
                                isRunning = true;

                                while (!forceStop)
                                {
                                    client.Update();
                                    rhClient.Update();
                                    Thread.Yield();
                                }

                                rhClient.ButtonChanged -= rhClient_ButtonChanged;
                            }
                        }
                        else
                        {
                            //Only the left hand server should be used
                            using (ButtonRemote lhClient = new ButtonRemote(lhServerName))
                            {
                                lhClient.ButtonChanged += lhClient_ButtonChanged;
                                isRunning = true;

                                while (!forceStop)
                                {
                                    client.Update();
                                    lhClient.Update();
                                    Thread.Yield();
                                }

                                lhClient.ButtonChanged -= lhClient_ButtonChanged;
                            }
                        }
                    }
                    else
                    {
                        if (rhServerName == lhServerName)
                        {
                            //The left and right hand should be used, but they are on the same server
                            using (ButtonRemote handClient = new ButtonRemote(rhServerName))
                            {
                                handClient.ButtonChanged += rhClient_ButtonChanged;
                                isRunning = true;

                                while (!forceStop)
                                {
                                    client.Update();
                                    handClient.Update();
                                    Thread.Yield();
                                }

                                handClient.ButtonChanged -= rhClient_ButtonChanged;
                            }
                        }
                        else
                        {
                            //Both the left and right hand should be used, and they are on different servers
                            using (ButtonRemote rhClient = new ButtonRemote(rhServerName))
                            {
                                using (ButtonRemote lhClient = new ButtonRemote(lhServerName))
                                {
                                    rhClient.ButtonChanged += rhClient_ButtonChanged;
                                    lhClient.ButtonChanged += lhClient_ButtonChanged;
                                    isRunning = true;

                                    while (!forceStop)
                                    {
                                        client.Update();
                                        rhClient.Update();
                                        lhClient.Update();
                                        Thread.Yield();
                                    }

                                    rhClient.ButtonChanged -= rhClient_ButtonChanged;
                                    lhClient.ButtonChanged -= lhClient_ButtonChanged;
                                }
                            }
                        }
                    }
                }
                else
                {
                    //No hand servers case
                    isRunning = true;

                    while (!forceStop)
                    {
                        client.Update();
                        Thread.Yield();
                    }
                }

                client.PositionChanged -= client_PositionChanged;
            }

            isRunning = false;
        }