Example #1
0
        private void CriaElementoFila(int numElement)
        {
            var el = new QueueElement();

            el.Data = textBox3.Text;
            Canvas.SetLeft(el, canvas3.ActualWidth + 60);
            canvas3.Children.Add(el);
            var duration = new Duration(TimeSpan.FromSeconds(0.2));
            var da1      = new DoubleAnimation(numElement * 58, duration);

            da1.DecelerationRatio = 1;
            el.BeginAnimation(Canvas.LeftProperty, da1);
        }
Example #2
0
        public void Enqueue(T value)
        {
            var newElement = new QueueElement <T>(value);

            if (IsEmpty())
            {
                _head = _tail = newElement;
            }
            else
            {
                _tail.Previous = newElement;
                _tail          = newElement;
            }
        }
Example #3
0
        public T Dequeue()
        {
            if (IsEmpty())
            {
                throw new InvalidOperationException("The queue is empty.");
            }

            T value = _head.Value;

            _head = _head.Previous;
            if (_head == null)
            {
                _tail = null;
            }

            return(value);
        }
Example #4
0
 public Queue()
 {
     _head = null;
     _tail = null;
 }