Example #1
0
        //判断选择类型为巷道还是节点
        public void Display(string type, object entity)
        {
            switch (type)
            {
            case "Tunnel":
                DPTunnel tunnel = entity as DPTunnel;
                propertyGridControl1.SelectedObject = entity;
                break;

            case "Node":
                DPNode node = entity as DPNode;
                propertyGridControl1.SelectedObject = entity;
                break;

            default:
                propertyGridControl1.SelectedObject = null;
                break;
            }
        }
Example #2
0
        //数据库dblite修改后事件
        private void dataUpdated(object sender, DBEntity entity)
        {
            Document        doc       = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            DBEntityControl dbControl = Project.Instance.GetTmpEntCol(doc);

            if (dbControl.Senders.Contains(Project.Instance.GetActivePropCtl(doc)))
            {
                return;
            }

            var selEntity = this.propertyGridControl1.SelectedObject;

            if (selEntity == null)
            {
                return;
            }

            if (selEntity is DPNode && entity is DBNode)
            {
                if (entity.HandleValue != ((DPNode)selEntity).HandleValue)
                {
                    return;
                }
                DPNode displayNode = new DPNode();
                displayNode.SetFromDBEntity(entity as DBNode);
                this.propertyGridControl1.SelectedObject = displayNode;
                this.propertyGridControl1.Refresh();
            }
            else if (selEntity is DPTunnel && entity is DBTunnel)
            {
                if (entity.HandleValue != ((DPTunnel)selEntity).HandleValue)
                {
                    return;
                }
                DPTunnel displayTunnel = new DPTunnel();
                //if (displayTunnel.HandleValue != entity.HandleValue) return;
                displayTunnel.SetFromDBObject(entity as DBTunnel);
                this.propertyGridControl1.SelectedObject = displayTunnel;
                this.propertyGridControl1.Refresh();
            }
        }