コード例 #1
0
ファイル: AddNode.cs プロジェクト: tylike/InfoMatrix
        protected override void OnChanged(string propertyName, object oldValue, object newValue)
        {
            base.OnChanged(propertyName, oldValue, newValue);
            if (!IsLoading && !IsSaving)
            {
                if (propertyName == "NodeType")
                {
                    if (Node != null)
                    {
                        Node.Delete();
                    }

                    if (NodeType == SYS.NodeType.Form)
                    {
                        Node = new FlowChartFormNode(Session);
                    }
                    else
                    {
                        Node = new FlowChartNode(Session);
                    }
                    Node.X = this.X;
                    Node.Y = this.Y;
                }
            }
        }
コード例 #2
0
        public FlowChartFormNode AddNode(FlowChartFormNode parent, string name, Position pos, int defaultStep = 200)
        {
            var x = 0;
            var y = 0;
            var s = defaultStep;

            switch (pos)
            {
            case Position.Left:
                x -= s;
                break;

            case Position.LeftTop:
                x -= s;
                y -= s;
                break;

            case Position.Top:
                y -= s;
                break;

            case Position.RightTop:
                x += s;
                y -= s;
                break;

            case Position.Right:
                x += s;
                break;

            case Position.RightBottom:
                x += s;
                y += s;
                break;

            case Position.Bottom:
                y += s;
                break;

            case Position.LeftBottom:
                x -= s;
                y -= s;
                break;

            default:
                break;
            }
            var node = AddNode(name, int.Parse(parent.X) + x, int.Parse(parent.Y) + y);
            var edge = new FlowChartEdge(Session);

            edge.From                = parent;
            edge.To                  = node;
            edge.Caption             = "生成" + edge.To.Caption;
            edge.AutoGenerateMapping = true;
            this.Edges.Add(edge);

            return(node);
        }
コード例 #3
0
        public FlowChartFormNode AddNode(string name, int x, int y)
        {
            var node = new FlowChartFormNode(Session);

            node.ModelClass = BOS.SingleOrDefault(t => t.Name == "BusinessObject.I" + name);
            node.X          = x.ToString();
            node.Y          = y.ToString();
            this.Nodes.Add(node);
            return(node);
        }