Ejemplo n.º 1
0
        private void 添加子事件ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var node = treeViewRoot.SelectedNode;

            if (node.Level < 4)
            {
                MessageBox.Show("不能在这里添加子事件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            FormAddCode addform = new FormAddCode();

            if (addform.ShowDialog() == DialogResult.OK)
            {
                if (addform.m_select < 4)
                {
                    MessageBox.Show("code 0,1,2,3不能被手动添加", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                ScriptSection sec    = (ScriptSection)getLeve2Nodes(node).Tag;
                ScriptCommand newCmd = (ScriptCommand)node.Parent.Tag;
                newCmd.extValue = 2;
                sec.addCode(0, newCmd);
                sec.addCode(addform.m_select, newCmd, true);
                sec.addCode(1, newCmd);
                buildTreeView(scriptRoot[m_cur_index]);
            }
        }
Ejemplo n.º 2
0
 private void 添加ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (treeViewRoot.SelectedNode.Level == 1)
     {
         scriptRoot[m_cur_index].addScene((ScriptScene)treeViewRoot.SelectedNode.Tag);
     }
     else if (treeViewRoot.SelectedNode.Level == 2)
     {
         ScriptScene scene = (ScriptScene)treeViewRoot.SelectedNode.Parent.Tag;
         scene.addSection((ScriptSection)treeViewRoot.SelectedNode.Tag);
     }
     else if (treeViewRoot.SelectedNode.Level == 3)
     {
         MessageBox.Show("不能在此处添加", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     else if (treeViewRoot.SelectedNode.Level > 3)
     {
         FormAddCode addform = new FormAddCode(0, selectIndex);
         if (addform.ShowDialog() == DialogResult.OK)
         {
             selectIndex = addform.m_select + 1;
             if (addform.m_select < 4)
             {
                 MessageBox.Show("code 0,1,2,3不能被手动添加", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
             ScriptSection sec = (ScriptSection)getLeve2Nodes(treeViewRoot.SelectedNode).Tag;
             sec.addCode(addform.m_select, (ScriptCommand)treeViewRoot.SelectedNode.Parent.Tag);
         }
     }
     buildTreeView(scriptRoot[m_cur_index]);
 }