private void ToolStripMenuItem_Insert_Click(object sender, EventArgs e) { int idx = toolStripComboBox_Index.SelectedIndex; if (idx < 0) { MessageBox.Show("请选择动作节点序号"); return; } Type methodType = currNode.Tag as Type; string dafaultNewName = _methodFlow.GetDefaultNameWillAddMethod(methodType); BenameDialog bnd = new BenameDialog(); bnd.Text = "新方法节点命名"; bnd.SetName(dafaultNewName); if (DialogResult.OK != bnd.ShowDialog()) { return; } IJFMethod newMethod = JFMethodFlow.CreateMethod(methodType.Name); bool isOK = _methodFlow.Insert(newMethod, idx, bnd.GetName()); if (isOK) { ShowTips("插入动作节点成功!"); UpdateFlow2UI(); } else { MessageBox.Show("插入动作节点失败,请检查\n节点序号是否超限/动作名称是否已存在于流程中!"); return; } }
/// <summary> /// 添加一个方法对象到动作流中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ToolStripMenuItem_Add_Click(object sender, EventArgs e) { Type methodType = currNode.Tag as Type; string dafaultNewName = _methodFlow.GetDefaultNameWillAddMethod(methodType); BenameDialog bnd = new BenameDialog(); bnd.Text = "新方法节点命名"; bnd.SetName(dafaultNewName); if (DialogResult.OK != bnd.ShowDialog()) { return; } IJFMethod newMethod = JFMethodFlow.CreateMethod(methodType.Name); bool isOK = _methodFlow.Add(newMethod, bnd.GetName()); if (isOK) { ToolStripMenuItem_Insert.Enabled = true; ShowTips("添加动作节点成功!"); UpdateFlow2UI(); } else { MessageBox.Show("添加动作节点失败,请检查动作名称是否已存在于流程中!"); return; } }