Example #1
0
        private void ConnectNodes(StationTopoloty topo1, StationTopoloty topo2, string deviceName1, string deviceName2)
        {
            TopolotyNode leftNode = null;

            foreach (var item in topo1.Nodes)
            {
                if (item.NodeDevice.Name == deviceName1)
                {
                    leftNode = item;
                }
            }

            TopolotyNode rightNode = null;

            foreach (var item in topo2.Nodes)
            {
                if (item.NodeDevice.Name == deviceName2)
                {
                    rightNode = item;
                }
            }

            if (leftNode != null && rightNode != null)
            {
                leftNode.RightNodes.Add(rightNode);
                rightNode.LeftNodes.Add(leftNode);
            }
        }
Example #2
0
        public void GetElement()
        {
            StationTopoloty topo      = (App.Current.MainWindow as MainWindow).Topo;
            TopolotyNode    startNode = topo.Nodes[0];

            线路绘图工具.Device device = startNode.FindDeviceByDistance(81.0);
            if (device != null)
            {
                MessageBox.Show(device.Name);
            }
            else
            {
                int a = device.ID;
            }
        }