Ejemplo n.º 1
0
        public virtual CodeGenerateSystem.Base.BaseNodeControl AddNodeControl(Type nodeType, EditorCommon.CodeGenerateSystem.INodeConstructionParams csParam, double x, double y, bool addToCanvas = true, bool setDirty = true)
        {
            object[] objects;
            //if(String.IsNullOrEmpty(Params))
            //    objects = new object[] { MainDrawCanvas };
            //else
            objects = new object[] { csParam };
            var ins = (CodeGenerateSystem.Base.BaseNodeControl)System.Activator.CreateInstance(nodeType, objects);

            //ins.HostNodesContainer = this;
            //ins.OnMoveNode += new BaseNodeControl.Delegate_MoveNode(OnMoveNode);
            //ins.OnGetOwnerStateSetClassTypeName += new CodeGenerateSystem.Base.BaseNodeControl.Delegate_GetOwnerStateSetClassTypeName(OnGetOwnerStateSetClassTypeName);
            ins.OnDirtyChange = new BaseNodeControl.Delegate_DirtyChanged(OnControlDirtyChanged);
            ////////////if (nodeType == typeof(StatementNode))
            ////////////{
            ////////////    StatementNode stateNode = ins as StatementNode;
            ////////////    stateNode.OnSetDefaultState += new StatementNode.Delegate_OnSetDefaultState(stateNode_OnSetDefaultState);
            ////////////}
            //ins.OnGetLinkObjectWithGUID += new CodeGenerateSystem.Base.BaseNodeControl.Delegate_GetLinkObjectWithGUID(OnGetLinkObjectWithGUID);
            ins.ModifyCreatePosition(ref x, ref y);
            AddNodeControl_WPF(ins, addToCanvas, x, y);
            OnInitializeNodeControl?.Invoke(ins);

            if (addToCanvas)
            {
                mCtrlNodeList.Add(ins);
            }

            ContainLinkNodes = mCtrlNodeList.Count != OrigionNodeControls.Count;
            RefreshNodeProperty(ins, Base.ENodeHandleType.AddNodeControl);
            if (!IsLoading)
            {
                OnAddedNodeControl?.Invoke(ins);
                if (setDirty)
                {
                    IsDirty = true;
                }
            }

            ScaleChange -= ins.ScaleTips;
            ScaleChange += ins.ScaleTips;

            return(ins);
        }
Ejemplo n.º 2
0
        public virtual CodeGenerateSystem.Base.BaseNodeControl AddNodeControl(BaseNodeControl ins, double x, double y, bool addToCanvas = true, bool setDirty = true)
        {
            //ins.HostNodesContainer = this;
            //ins.OnMoveNode += new BaseNodeControl.Delegate_MoveNode(OnMoveNode);
            //ins.OnGetOwnerStateSetClassTypeName += new CodeGenerateSystem.Base.BaseNodeControl.Delegate_GetOwnerStateSetClassTypeName(OnGetOwnerStateSetClassTypeName);
            ins.OnDirtyChange = new BaseNodeControl.Delegate_DirtyChanged(OnControlDirtyChanged);
            ////////////if (nodeType == typeof(StatementNode))
            ////////////{
            ////////////    StatementNode stateNode = ins as StatementNode;
            ////////////    stateNode.OnSetDefaultState += new StatementNode.Delegate_OnSetDefaultState(stateNode_OnSetDefaultState);
            ////////////}
            //ins.OnGetLinkObjectWithGUID += new CodeGenerateSystem.Base.BaseNodeControl.Delegate_GetLinkObjectWithGUID(OnGetLinkObjectWithGUID);
            ins.ModifyCreatePosition(ref x, ref y);
            AddNodeControl_WPF(ins, addToCanvas, x, y);
            OnInitializeNodeControl?.Invoke(ins);

            if (addToCanvas)
            {
                mCtrlNodeList.Add(ins);
            }

            ContainLinkNodes = mCtrlNodeList.Count != OrigionNodeControls.Count;
            RefreshNodeProperty(ins, Base.ENodeHandleType.AddNodeControl);
            if (!IsLoading)
            {
                OnAddedNodeControl?.Invoke(ins);
                if (setDirty)
                {
                    IsDirty = true;
                }
            }

            ScaleChange -= ins.ScaleTips;
            ScaleChange += ins.ScaleTips;

            return(ins);
        }