Пример #1
0
        /// <summary>
        /// Callback from Tool.AddChild to try to handle other
        /// active tools - trying to disable them.
        /// </summary>
        /// <param name="child">Child that has just been added.</param>
        public static void OnChildAdded(Tool child)
        {
            if (child == null)
            {
                return;
            }

            var root = child.GetRoot() as CustomTargetTool;

            if (root == null)
            {
                return;
            }

            foreach (var targetTool in ActiveTools)
            {
                if (targetTool == root)
                {
                    continue;
                }

                Traverse(targetTool, tool =>
                {
                    if (!tool.IsSingleInstanceTool)
                    {
                        return(false);
                    }
                    tool.PerformRemoveFromParent();
                    return(true);
                });
            }
        }
Пример #2
0
        /// <summary>
        /// Callback from Tool.AddChild to try to handle other
        /// active tools - trying to disable them.
        /// </summary>
        /// <param name="child">Child that has just been added.</param>
        public static void OnChildAdded(Tool child)
        {
            if (child == null)
            {
                return;
            }

            var root = child.GetRoot() as CustomTargetTool;

            if (root == null)
            {
                return;
            }

            foreach (var targetTool in ActiveTools)
            {
                if (targetTool == root)
                {
                    continue;
                }

                foreach (var targetToolChild in targetTool.GetChildren())
                {
                    // Ignoring any route node tools for now. This should disable
                    // any FrameTool that's active under the route node tool.
                    if (targetToolChild is RouteNodeTool)
                    {
                        continue;
                    }

                    targetToolChild.PerformRemoveFromParent();
                }
            }
        }