예제 #1
0
        private void ProcessQueue(object cancellationTokenObject)
        {
            var token = (CancellationToken)cancellationTokenObject;

            while (_started)
            {
                ICardreaderAction action = null;

                try
                {
                    action = _actionQueue.Take(token);
                }
                catch (OperationCanceledException)
                {
                    // Take operation was canceled
                    Logger.TraceEvent(TraceEventType.Verbose, 0, "Token was canceled for Action Queue");
                    Logger.Flush();
                }

                if (action == null)
                {
                    continue;
                }

                action.Execute(_lowLevelCardReader);
            }
        }
예제 #2
0
        public void EnqueueAction(ICardreaderAction action)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("ActionQueue", "Cannot enqueue to a disposed queue.");
            }

            _actionQueue.Add(action);
        }
예제 #3
0
        public void EnqueueAction(ICardreaderAction action)
        {
            if (_disposed) throw new ObjectDisposedException("ActionQueue", "Cannot enqueue to a disposed queue.");

            _actionQueue.Add(action);
        }