Esempio n. 1
0
        private void btn_save_Click(object sender, System.EventArgs e)
        {
            if (this.tb_flowName.Text.Length < 0)
            {
                MessageForm.Show("文件名不能为空。");
                this.tb_flowName.Focus();
                return;
            }
            else if (this.tb_flowName.Text.Length > 20)
            {
                MessageForm.Show("文件名过长。");
                this.tb_flowName.Focus();
                return;
            }
            int p = tb_flowName.Text.LastIndexOf(".");

            if (p < 0 || tb_flowName.Text.Substring(p).ToUpper() != ".XML")
            {
                tb_flowName.Text += ".xml";
            }
            foreach (ListViewItem temp in lv_flowView.Items)
            {
                if (temp.Text == this.tb_flowName.Text)
                {
                    DialogResult dr = MessageForm.Show("文件名己存在,是否覆盖己有文件", ButtonType.YesAndNo);
                    if (dr == DialogResult.Yes)
                    {
                        this.FileName     = this.tb_flowName.Text;
                        this.SaveOperate  = "Save";
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        return;
                    }
                    break;
                }
            }
            this.FileName     = this.tb_flowName.Text;
            this.SaveOperate  = "Save";
            this.DialogResult = DialogResult.OK;
        }
Esempio n. 2
0
        /// <summary>
        /// 改变节点的类型
        /// </summary>
        public bool ChangeNodeType()
        {
            if (this.cb_nodeType.Text != DrawObject.getDefaultText(node.ObjectType))
            {
                if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawNodeGeneral))
                {
                    if (this.control.drawObject.i_GeneralCount >= 20)
                    {
                        MessageForm.Show("对不起,您目前选择的节点限制为20个.", "DrawFlow");
                        return(true);
                    }
                }
                else if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawNodeBegin))
                {
                    if (this.control.drawObject.bStartFlag)
                    {
                        MessageForm.Show("对不起,开始节点创建受限制。", "DrawFlow");
                        return(true);
                    }
                    else if (this.node.ConnectInCount > 0)
                    {
                        MessageForm.Show("您要更改的节点的不满足转为开始节点的要求,开始节点没有前驱,有多个后继 .", "DrawFlow");
                        return(true);
                    }
                }
                else if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawNodeEnd))
                {
                    if (this.control.drawObject.bStartFlag)
                    {
                        MessageForm.Show("对不起,结束节点创建受限制。", "DrawFlow");
                        return(true);
                    }
                    else if (this.node.ConnectOutCount > 0)
                    {
                        MessageForm.Show("您要更改的节点的不满足转为结束节点的要求,结束节点有多个前驱,没有后继。", "DrawFlow");
                        return(true);
                    }
                }
                else if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawAsunder))
                {
                    if (this.node.ConnectInCount > 1)
                    {
                        MessageForm.Show("您要更改的节点的不满足转为分支节点的要求,分支节点只有一个前驱,有多个后继。", "DrawFlow");
                        return(true);
                    }
                }
                else if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawConverge))
                {
                    if (this.node.ConnectOutCount > 1)
                    {
                        MessageForm.Show("您要更改的节点的不满足转为汇聚节点的要求,汇聚节点有多个前驱,只有一个后继。", "DrawFlow");
                        return(true);
                    }
                }
                else if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawDataNode))
                {
                    if (this.node.ConnectInCount > 0)
                    {
                        MessageForm.Show("您要更改的节点的不满足转为数据节点的要求,数据节点没有前驱,有多个后继。", "DrawFlow");
                        return(true);
                    }
                }
                else if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawGather))
                {
                    if (this.node.ConnectOutCount > 1)
                    {
                        MessageForm.Show("您要更改的节点的不满足转为汇总节点的要求,汇总节点有多个前驱,只有一个后继。", "DrawFlow");
                        return(true);
                    }
                }
                else if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawGradation))
                {
                    if (this.node.ConnectInCount > 1 || this.node.ConnectOutCount > 1)
                    {
                        MessageForm.Show("您要更改的节点的不满足转为顺序节点的要求,顺序节点只有一个前驱,只有一个后继。", "DrawFlow");
                        return(true);
                    }
                }
                else if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawSpecificallyOperation))
                {
                    if (this.node.ConnectInCount > 1 || this.node.ConnectOutCount > 0)
                    {
                        MessageForm.Show("您要更改的节点的不满足转为特定操作节点的要求,特定操作节点只有一个前驱,没有后继。", "DrawFlow");
                        return(true);
                    }
                }
                else if (this.cb_nodeType.Text == DrawObject.getDefaultText(Node.DrawObjectType.DrawSynchronization))
                {
                    if (this.node.ConnectInCount > 2 || this.node.ConnectOutCount > 1)
                    {
                        MessageForm.Show("您要更改的节点的不满足转为同步节点的要求,同步节点只有两个前驱,有一个后继。", "DrawFlow");
                        return(true);
                    }
                }
                switch (this.cb_nodeType.Text)
                {
                case "开始": node.ObjectType = Node.DrawObjectType.DrawNodeBegin; this.control.drawObject.bStartFlag = true; break;

                case "任务": node.ObjectType = Node.DrawObjectType.DrawNodeGeneral; this.control.drawObject.i_GeneralCount++; break;

                case "特定操作": node.ObjectType = Node.DrawObjectType.DrawSpecificallyOperation; break;

                case "顺序": node.ObjectType = Node.DrawObjectType.DrawGradation; break;

                case "同步": node.ObjectType = Node.DrawObjectType.DrawSynchronization; break;

                case "分支": node.ObjectType = Node.DrawObjectType.DrawAsunder; break;

                case "汇聚": node.ObjectType = Node.DrawObjectType.DrawConverge; break;

                case "汇总连接": node.ObjectType = Node.DrawObjectType.DrawGather; break;

                case "判断": node.ObjectType = Node.DrawObjectType.DrawJudgement; break;

                case "应用数据": node.ObjectType = Node.DrawObjectType.DrawDataNode; break;

                case "结束": node.ObjectType = Node.DrawObjectType.DrawNodeEnd; this.control.drawObject.bEndFlag = true; break;

                case "矩形": node.ObjectType = Node.DrawObjectType.DrawRectangle; break;

                case "椭圆形": node.ObjectType = Node.DrawObjectType.DrawEllipse; break;
                }
            }
            return(false);
        }
Esempio n. 3
0
 public void ShowForm(string str)
 {
     MessageForm.Show(str);
 }