Cirrious.MvvmCross.Plugins.Sphero.HackFileShare.NonAwaitingConnectedSpheroRunner.SendCommmands C# (CSharp) Method

SendCommmands() private method

private SendCommmands ( ) : void
return void
        private void SendCommmands()
        {
            try
            {
                while (true)
                {
                    var waitResult = _itemsReadyEvent.WaitOne(100);

                    if (!waitResult)
                    {
                        if (_disconnected)
                        {
                            break;
                        }
                        continue;
                    }

                    CommandWithActions toSendThisTime = null;
                    lock (_commandsToSend)
                    {
                        toSendThisTime = _commandsToSend.Dequeue();
                        if (_commandsToSend.Count == 0)
                        {
                            _itemsReadyEvent.Reset();
                        }
                    }

                    SendCommand(toSendThisTime);
                }
            }
            catch (SpheroPluginException exception)
            {
                // assume disconnected
                RaiseDisconnected();
            }
        }