Beispiel #1
0
        /// <summary>
        /// 显示Visio面板图
        /// </summary>
        /// <param name="VdxFile">面板图Vdx文件</param>
        private void ShowVisioPanel(string VdxFile)
        {

            try
            {
                this.Ports.Clear();
                this.Modules.Clear();
                this.Lamps.Clear();

                VisioImporter VisioImporter = new VisioImporter();
                VisioImporter.pFlowChartBox.Clear();
                //Scale = 1.0f;
                Log.WriteLog("开始装载面板图...");
                this._document.SuspendLayout();                
                VisioImporter.ImportPage(VdxFile, _document, 0, Convert.ToInt32(_panel_location.X), Convert.ToInt32(_panel_location.Y));
                this._document.ResumeLayout(false);
                this._document.PerformLayout();
                _panel_size = new SizeF(Convert.ToSingle(VisioImporter.pEquipmentInfo.Width), Convert.ToSingle(VisioImporter.pEquipmentInfo.Height));
                _eqinfo = VisioImporter.pEquipmentInfo;
                //模块清单 this.GetType().Name.ToString() +
                Log.WriteLog("开始初始化模块清单...");
                foreach (SiteView.VisioImport.VisioImporter.EquipmentContainer i in VisioImporter.pEquipmentContainer) //遍历
                {
                    foreach (Box box in _document.Boxes)
                    {
                        if (box.Tag == (object)i.Alias)
                        {
                            Module module = new Module();
                            module.Document = this.Document;
                            module.Index = i.ContainerIndex;
                            //module.Name = i.Alias;
                            module.Name = "module" + i.ContainerIndex.ToString();
                            module.Instance = box;
                            module.Rect = i.rect;
                            module.Location = i.rect.Location;
                            module.Parent = this;
                            _modules.Add(module);
                        }
                    }
                }
                Log.WriteLog("初始化模块清单成功!");
                Log.WriteLog("开始初始化端口清单...");
                //端口清单
                foreach (SiteView.VisioImport.VisioImporter.EquipmentPort i in VisioImporter.pEquipmentPort) //遍历
                {
                    foreach (Box box in _document.Boxes)
                    {
                        if (box.Tag == (object)i.Alias)
                        {
                            Port port = new Port();
                            port.Index = i.PhysicsPortIndex;
                            //port.Name = i.Alias;
                            port.Name = "port" + i.PhysicsPortIndex;
                            port.Instance = box;
                            _ports.Add(port);
                        }
                    }
                }
                Log.WriteLog("初始化端口清单成功!");
                Log.WriteLog("开始初始化指示灯清单...");
                //指示灯清单
                foreach (SiteView.VisioImport.VisioImporter.EquipmentLamp i in VisioImporter.pEquipmentLamp) //遍历
                {
                    foreach (Box box in _document.Boxes)
                    {
                        if (box.Tag == (object)i.Alias)
                        {
                            Lamp lamp = new Lamp();
                            lamp.Index = i.PhysicsPortLampIndex;
                            //lamp.Name = i.Alias;
                            lamp.Name = "lamp" + i.PhysicsPortLampIndex;
                            lamp.Instance = box;
                            _lamps.Add(lamp);
                        }
                    }
                }
                Log.WriteLog("初始化指示灯清单成功!");
                Log.WriteLog("开始初始化box清单...");
                //面板图box清单
                foreach (SiteView.VisioImport.VisioImporter.FlowChartBox i in VisioImporter.pFlowChartBox)
                {
                    foreach (Box box in _document.Boxes)
                    {
                        if (box.Tag == (object)i.Alias)
                        {
                            box.Locked = true;
                            _boxes.Add(box);
                        }
                    }
                }
                Log.WriteLog("初始化box清单成功!");
                //设备清单
                /*foreach(SiteView.VisioImport.VisioImporter.EquipmentPort i in VisioImporter.pEquipmentPort)
                {
                    foreach(Box box in _document.Boxes)
                    {
                        if(box.Tag == (object)i.Alias)
                        {
                            Device device = new Device();
                            device.Index = i.PhysicsPortIndex;
                            device.Name = "device" + i.PhysicsPortIndex;
                            device.Instance = box;
                            _devices.Add(device);
                        }
                    }
                }*/
                System.Threading.Thread.Sleep(2000);
                Log.WriteLog("装载面板图成功!");
                this._isnull = false;

            }
            catch (Exception ex)
            {
                this._isnull = true;
                Log.WriteLog("装载面板图失败!原因:" + ex.ToString());
            }

        }
Beispiel #2
0
        /// <summary>
        /// 显示拓扑图
        /// </summary>
        private void ShowTopGraphics()
        {

            string vdxFileName = System.IO.Path.GetFileName(Vdx);
            this.Devices.Clear();
            VisioImporter VisioImporter = new VisioImporter();
            VisioImporter.ImportPage(vdxFileName, _document, 0, 5, 5);

        }