示例#1
0
 private void _worker_DoWork(object sender, DoWorkEventArgs e)
 {
     _isRunning = true;
     while (_isRunning)
     {
         Shared.Contract.IPackage package = _queue.WaitForNextPackage();
         //Console.WriteLine($"Processing package number {package.Id}");
         _actionHandler.ExecuteDataActionFor(package.Communication, package.Data);
     }
 }
        private void CheckForUpdates()
        {
            while (true)
            {
                var communicated = false;

                _serverInfo._communications.ForEach(communication =>
                {
                    if (communication.IsDataAvailable())
                    {
                        var data = communication.Receive();
                        _ActionsHandler.ExecuteDataActionFor(communication, data);
                        communicated = true;
                    }
                });

                if (!communicated)
                {
                    Thread.Sleep(1);
                }
            }
        }