Exemplo n.º 1
0
            private List <Tool> CreateTools()
            {
                if (oldNode.getChildCount() > 1 && !Controller.Instance.ShowStrictConfirmDialog("Forbidden!", "Replacing this node will keep only the first child (the rest nodes will be deleted!). Continue?"))
                {
                    return(null);
                }

                var tools = from node in content.getAllNodes()
                            from child in node.getChilds().Select((n, i) => new { n, i })
                            where child.n == oldNode
                            select(Tool) new ConversationNodeDataControl.LinkConversationNodeTool(content, node, newNode, child.i);

                var toolsList = tools.ToList();

                if (oldNode.getChildCount() > 0)
                {
                    toolsList.Add(new ConversationNodeDataControl.AddRemoveConversationNodeTool(newNode, oldNode.getChilds()[0], 0));
                }

                if (oldNode == content.getRootNode())
                {
                    isRoot = true;
                }

                return(toolsList);
            }
Exemplo n.º 2
0
            private List <ConversationNodeDataControl.AddRemoveConversationNodeTool> CreateTools()
            {
                if (toRemove.getChildCount() > 1 && !Controller.Instance.ShowStrictConfirmDialog("Forbidden!", "Deleting this node will keep only the first child (the rest nodes will be deleted!). Continue?"))
                {
                    return(null);
                }

                if (toRemove == content.getRootNode())
                {
                    if (toRemove.getChildCount() == 0)
                    {
                        Controller.Instance.ShowErrorDialog("Forbidden!", "Deleting the last node is forbidden!");
                        return(null);
                    }

                    isRoot = true;
                }


                var tools = from node in content.getAllNodes()
                            from child in node.getChilds().Select((n, i) => new { n, i })
                            orderby child.i descending
                            where child.n == toRemove
                            select new ConversationNodeDataControl.AddRemoveConversationNodeTool(node, child.i);

                return(tools.ToList());
            }