public override void OnCreate()
        {
            NodeGraphManager.CreateNodePropertyPort(false, Guid.NewGuid(), this, true, typeof(object), null,
                                                    "Objects", false, null, "Objects", true);

            base.OnCreate();
        }
        private NodePropertyPort createPort(string title, bool isInput, bool editor = true)
        {
            var ValuePort = NodeGraphManager.CreateNodePropertyPort(
                false, Guid.NewGuid(), this,
                isInput, typeof(int), Activator.CreateInstance(typeof(int)), title, editor, null, "");

            return(ValuePort);
        }
        private NodePropertyPort createPort(string title, bool isInput, bool editor = true)
        {
            var ValuePort = NodeGraphManager.CreateNodePropertyPort(
                false, Guid.NewGuid(), this,
                isInput, typeof(string), "", title, editor, null, "");

            ValuePort.PropertyChanged += Port_PropertyChanged;

            return(ValuePort);
        }
        public override void OnCreate()
        {
            NodeGraphManager.CreateNodePropertyPort(false, Guid.NewGuid(), this, true, typeof(object), null,
                                                    "Objects", false, null, "Objects( multiple input )", true);

            NodeGraphManager.CreateNodePropertyPort(false, Guid.NewGuid(), this, false, typeof(ObservableCollection <object>), new ObservableCollection <object>(),
                                                    "Array", false, null, "Array");

            base.OnCreate();
        }
Esempio n. 5
0
        public override void OnCreate()
        {
            NodePropertyPort port = NodeGraphManager.CreateNodePropertyPort(
                false, Guid.NewGuid(), this, false,
                typeof(ObservableCollection <T>), Array, "Array", true);

            port.DynamicPropertyPortValueChanged += ArrayPort_DynamicPropertyPortValueChanged;

            base.OnCreate();
        }
Esempio n. 6
0
        public override void OnCreate()
        {
            Type type = typeof(T);

            NodePropertyPort port = NodeGraphManager.CreateNodePropertyPort(
                false, Guid.NewGuid(), this, false, type, Activator.CreateInstance(type), "Value", true, null, "");

            port.DynamicPropertyPortValueChanged += ValuePort_PropertyPortValueChanged;

            base.OnCreate();
        }
Esempio n. 7
0
        public override void OnCreate()
        {
            NodeGraphManager.CreateNodePropertyPort(false, Guid.NewGuid(), this, true, typeof(ObservableCollection <object>), new ObservableCollection <object>(),
                                                    "Array", false, null, "Array");

            NodeGraphManager.CreateNodePropertyPort(false, Guid.NewGuid(), this, false, typeof(object), null,
                                                    "ArrayElement", false, null, "Array Element");

            NodeGraphManager.CreateNodePropertyPort(false, Guid.NewGuid(), this, false, typeof(int), -1,
                                                    "ArrayIndex", false, null, "Array Index");

            base.OnCreate();
        }
Esempio n. 8
0
        public override void ReadXml(XmlReader reader)
        {
            base.ReadXml(reader);

            Header = reader.GetAttribute("Header");
            HeaderBackgroundColor = new SolidColorBrush(
                ( Color )ColorConverter.ConvertFromString(reader.GetAttribute("HeaderBackgroundColor")));
            HeaderFontColor = new SolidColorBrush(( Color )ColorConverter.ConvertFromString(
                                                      reader.GetAttribute("HeaderFontColor")));
            AllowEditingHeader = bool.Parse(reader.GetAttribute("AllowEditingHeader"));

            AllowCircularConnection = bool.Parse(reader.GetAttribute("AllowCircularConnection"));

            X      = double.Parse(reader.GetAttribute("X"));
            Y      = double.Parse(reader.GetAttribute("Y"));
            ZIndex = int.Parse(reader.GetAttribute("ZIndex"));

            bool isInputFlowPortsEnd      = false;
            bool isOutputFlowPortsEnd     = false;
            bool isInputPropertyPortsEnd  = false;
            bool isOutputPropertyPortsEnd = false;

            while (reader.Read())
            {
                if (XmlNodeType.Element == reader.NodeType)
                {
                    if (("PropertyPort" == reader.Name) ||
                        ("FlowPort" == reader.Name))
                    {
                        string prevReaderName = reader.Name;

                        Guid guid    = Guid.Parse(reader.GetAttribute("Guid"));
                        Type type    = Type.GetType(reader.GetAttribute("Type"));
                        Type vmType  = Type.GetType(reader.GetAttribute("ViewModelType"));
                        bool isInput = bool.Parse(reader.GetAttribute("IsInput"));

                        string ownerGuidString = reader.GetAttribute("Owner");
                        Node   node            = NodeGraphManager.FindNode(Guid.Parse(ownerGuidString));

                        if ("PropertyPort" == prevReaderName)
                        {
                            string name      = reader.GetAttribute("Name");
                            Type   valueType = Type.GetType(reader.GetAttribute("ValueType"));
                            bool   hasEditor = bool.Parse(reader.GetAttribute("HasEditor"));

                            NodePropertyPort port = NodeGraphManager.CreateNodePropertyPort(
                                true, guid, node, isInput, valueType, null, name, hasEditor, vmType);
                            port.ReadXml(reader);
                        }
                        else
                        {
                            NodeFlowPort port = NodeGraphManager.CreateNodeFlowPort(
                                true, guid, node, isInput, vmType);
                            port.ReadXml(reader);
                        }
                    }
                }

                if (reader.IsEmptyElement || (XmlNodeType.EndElement == reader.NodeType))
                {
                    if ("InputFlowPorts" == reader.Name)
                    {
                        isInputFlowPortsEnd = true;
                    }
                    else if ("OutputFlowPorts" == reader.Name)
                    {
                        isOutputFlowPortsEnd = true;
                    }
                    else if ("InputPropertyPorts" == reader.Name)
                    {
                        isInputPropertyPortsEnd = true;
                    }
                    else if ("OutputPropertyPorts" == reader.Name)
                    {
                        isOutputPropertyPortsEnd = true;
                    }
                }

                if (isInputFlowPortsEnd && isOutputFlowPortsEnd &&
                    isInputPropertyPortsEnd && isOutputPropertyPortsEnd)
                {
                    break;
                }
            }
        }