Exemplo n.º 1
0
        private void AddScriptNode(INode node = null, string nodeName = "New Node")
        {
            EditableNode scriptNode = new EditableNode();
            scriptNode.NodeSelector.SelectionChangeCommitted += new System.EventHandler(NodeDropDownChanged);
            scriptNode.NodeSelector.Click += new EventHandler(NodeClicked);
            scriptNode.EditButton.Click += new EventHandler(NodeClicked);
            scriptNode.NodeSelector.Text = nodeName;

            scriptNode.NodeSelector.Items.Add("New Node");
            foreach (ScriptNode managerNode in ScriptNodeManager_cl.Instance.ScriptNodes.Values)
            {
                scriptNode.NodeSelector.Items.Add(managerNode.Name);
            }

            if (node != null)
            {
                scriptNode.CurrentNode = node;
            }

            mActiveNode = new KeyValuePair<int, EditableNode>(mRoutineNodes.Count, scriptNode);
            SetActiveNode(mActiveNode.Value);

            mRoutineNodes.Add(mRoutineNodes.Count, scriptNode);
            mRoutineNodesPanel.Controls.Add(scriptNode);
            scriptNode.Width = mRoutineNodesPanel.Width;
            scriptNode.NodeSelector.SelectedItem = nodeName;

            OrderNodes();
        }
Exemplo n.º 2
0
        private void HighlightActiveEditableNode(EditableNode activeNode)
        {
            foreach (KeyValuePair<int, EditableNode> nodePair in mRoutineNodes)
            {
                nodePair.Value.BackColor = Color.LightGray;
                if (nodePair.Value == activeNode)
                {
                    mActiveNode = nodePair;
                }
            }

            if (activeNode != null)
            {
                activeNode.BackColor = Color.LightGreen;
            }
        }
Exemplo n.º 3
0
 public void SetActiveNode(EditableNode node)
 {
     Control[] nodeEditorControls = Parent.Controls.Find("Node Editor Panel", false);
     if (nodeEditorControls.Length > 0)
     {
         ((NodeEditorPanel)nodeEditorControls[0]).SetActiveNode(node.CurrentNode);
     }
     HighlightActiveEditableNode(node);
 }