Ejemplo n.º 1
0
        /// <summary>
        /// Enumerates the UI with the specified visitor.
        /// </summary>
        /// <param name="visitor">The visitor.</param>
        public void Enumerate(IElementVisitor visitor)
        {
            visitor.Prepare(settings);

            var queue = new Queue <IElement>();

            queue.Enqueue(element);

            while (queue.Count > 0)
            {
                var current = queue.Dequeue();

                current.Accept(visitor);

                if (visitor.ShouldStopVisiting)
                {
                    break;
                }

                foreach (var dataBound in current.GetChildren(settings))
                {
                    queue.Enqueue(dataBound);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Enumerates the UI with the specified visitor.
        /// </summary>
        /// <param name="visitor">The visitor.</param>
        public void Enumerate(IElementVisitor visitor)
        {
            visitor.Prepare(_settings);

            var queue = new Queue<IElement>();
            queue.Enqueue(_element);

            while(queue.Count > 0)
            {
                var current = queue.Dequeue();

                current.Accept(visitor);

                if(visitor.ShouldStopVisiting) break;

                foreach(var dataBound in current.GetChildren(_settings))
                {
                    queue.Enqueue(dataBound);
                }
            }
        }