예제 #1
0
        public override void ReadXml(XmlReader reader)
        {
            base.ReadXml(reader);

            bool isNodesEnd      = false;
            bool isConnectorsEnd = false;

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

                        Guid      guid      = Guid.Parse(reader.GetAttribute("Guid"));
                        Type      type      = Type.GetType(reader.GetAttribute("Type"));
                        FlowChart flowChart = NodeGraphManager.FindFlowChart(
                            Guid.Parse(reader.GetAttribute("Owner")));

                        if ("Node" == prevReaderName)
                        {
                            Type vmType = Type.GetType(reader.GetAttribute("ViewModelType"));

                            Node node = NodeGraphManager.CreateNode(true, guid, flowChart, type, 0.0, 0.0, 0, vmType);
                            node.ReadXml(reader);
                        }
                        else
                        {
                            Connector connector = NodeGraphManager.CreateConnector(false, guid, flowChart, type);
                            connector.ReadXml(reader);
                        }
                    }
                }

                if (reader.IsEmptyElement || XmlNodeType.EndElement == reader.NodeType)
                {
                    if ("Nodes" == reader.Name)
                    {
                        isNodesEnd = true;
                    }
                    else if ("Connectors" == reader.Name)
                    {
                        isConnectorsEnd = true;
                    }
                }

                if (isNodesEnd && isConnectorsEnd)
                {
                    break;
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Never call this constructor directly. Use GraphManager.CreateConnector() method.
 /// </summary>
 public Connector(Guid guid, FlowChart flowChart) : base(guid)
 {
     FlowChart = flowChart;
 }
예제 #3
0
 /// <summary>
 /// Never call this constructor directly. Use GraphManager.CreateConnector() method.
 /// </summary>
 public Connector(NodeGraphManager npm, Guid guid, FlowChart flowChart) : base(guid)
 {
     NodeGraphManager = npm;
     FlowChart        = flowChart;
 }
예제 #4
0
 /// <summary>
 /// Never call this constructor directly. Use GraphManager.CreateNode() method.
 /// </summary>
 public Node(Guid guid, FlowChart flowChart) : base(guid)
 {
     Owner = flowChart;
 }
예제 #5
0
 /// <summary>
 /// Never call this constructor directly. Use GraphManager.CreateNode() method.
 /// </summary>
 public Node(NodeGraphManager ngm, Guid guid, FlowChart flowChart) : base(guid)
 {
     NodeGraphManager = ngm;
     Owner            = flowChart;
 }