コード例 #1
0
        private void ChooseMostActiveSkeletons(Skeleton[] skeletonData, int count)
        {
            foreach (ActivityWatcher watcher in recentActivity)
            {
                watcher.NewPass();
            }

            foreach (Skeleton s in skeletonData)
            {
                if (s.TrackingState != SkeletonTrackingState.NotTracked)
                {
                    ActivityWatcher watcher = recentActivity.Find(w => w.trackingId == s.TrackingId);
                    if (watcher != null)
                    {
                        watcher.Update(s);
                    }
                    else
                    {
                        recentActivity.Add(new ActivityWatcher(s));
                    }
                }
            }

            // Remove any skeletons that are gone
            recentActivity.RemoveAll(aw => !aw.updated);

            recentActivity.Sort();
            ChooseSkeletonsFromList(recentActivity.ConvertAll <int>(f => f.trackingId), count);
        }
コード例 #2
0
        private void ChooseMostActiveSkeletons(IEnumerable <Skeleton> skeletonDataValue, int count)
        {
            foreach (ActivityWatcher watcher in this.recentActivity)
            {
                watcher.NewPass();
            }

            foreach (Skeleton s in skeletonDataValue)
            {
                if (s.TrackingState != SkeletonTrackingState.NotTracked)
                {
                    ActivityWatcher watcher = this.recentActivity.Find(w => w.TrackingId == s.TrackingId);
                    if (watcher != null)
                    {
                        watcher.Update(s);
                    }
                    else
                    {
                        this.recentActivity.Add(new ActivityWatcher(s));
                    }
                }
            }

            // Remove any skeletons that are gone
            this.recentActivity.RemoveAll(aw => !aw.Updated);

            this.recentActivity.Sort();
            this.ChooseSkeletonsFromList(this.recentActivity.ConvertAll(f => f.TrackingId), count);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: bugRanger/Chat
        static void Main(string[] args)
        {
            LogManager.Configuration ??= new NLog.Config.LoggingConfiguration();

            var tcpProvider = new TcpProvider(NetworkSocket.Create);
            var udpProvider = new UdpProvider(NetworkSocket.Create);

            var watcher = new ActivityWatcher(tcpProvider)
            {
                Interval = 15000,
            };

            // TODO Impl udp transport layer.
            var provider      = new AudioProvider(udpProvider);
            var calls         = new CallController(new KeyContainer(), () => new BridgeRouter(provider));
            var authorization = new AuthorizationController();

            var core = new CoreApi(tcpProvider, new MessageFactory(true));

            new AuthApi(core, authorization);
            new TextApi(core, authorization);
            new CallApi(core, authorization, calls);

            // TODO Impl ping message.
            //watcher.Start();

            // TODO Add network interfaces.
            _ = tcpProvider.StartAsync(new IPEndPoint(IPAddress.Any, 30010));
            _ = udpProvider.StartAsync(new IPEndPoint(IPAddress.Any, 30010));

            Console.WriteLine("Press key:\r\n S - stop\r\n Q - exit");

            while (true)
            {
                var key = Console.ReadKey();
                switch (key.Key)
                {
                case ConsoleKey.Q:
                    return;

                case ConsoleKey.S:
                    tcpProvider.Stop();
                    udpProvider.Stop();
                    break;

                default:
                    break;
                }
            }
        }