Example #1
0
        /// <summary>
        /// Registers graphical element to enable UI events and drawing for it.
        /// </summary>
        public void Register(GraphicalElement element)
        {
            if (elements.Contains(element))
            {
                return;
            }

            elements.Add(element);

            elements.Sort((e1, e2) =>
            {
                if (e2.Layer > e1.Layer)
                {
                    return(1);
                }

                if (e2.Layer < e1.Layer)
                {
                    return(-1);
                }

                return(0);
            });

            element.HandleRegistration();

            foreach (GraphicalElement child in element.Children)
            {
                Register(child);
            }
        }
Example #2
0
        /// <summary>
        /// Registers graphical element to enable UI events and drawing for it.
        /// </summary>
        public void Register(GraphicalElement element)
        {
            if (element.Parent == null)
            {
                rootElements.Add(element);
            }

            element.HandleRegistration();

            foreach (GraphicalElement child in element.Children)
            {
                Register(child);
            }
        }