Exemplo n.º 1
0
        private void treeList1_MouseClick(object sender, MouseEventArgs e)
        {
            DevExpress.XtraTreeList.Nodes.TreeListNode node = null;
            DevExpress.XtraTreeList.TreeListHitInfo    hitInfo;
            if (e.Button == MouseButtons.Left)
            {
                hitInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y));
                if (hitInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell ||
                    hitInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.StateImage)
                {
                    node = treeList1.FocusedNode;
                    if (node != null)
                    {
                        var graph    = new GraphicOperations();
                        var jsonList = new List <PointNameAndDevName>();
                        if (GISPlatformCenter.Mapobj == null)//找不到对象,直接退出
                        {
                            return;
                        }
                        string json = graph.DoGetMapPointNameAndDevName(GISPlatformCenter.Mapobj);
                        if (!string.IsNullOrWhiteSpace(json))
                        {
                            jsonList = Basic.Framework.Common.JSONHelper.ParseJSONString <List <PointNameAndDevName> >(json);
                        }
                        if (node.StateImageIndex == 0)
                        {
                            SetState(node, 1);

                            GetCheckNode(treeList1);

                            if (jsonList != null && jsonList.Count > 0)
                            {
                                if (this.treeList1.Nodes[0].StateImageIndex == 1)
                                {
                                    foreach (var item in jsonList)
                                    {
                                        graph.PointDisplay(GISPlatformCenter.Mapobj, item.PointName);
                                    }
                                }
                                else
                                {
                                    foreach (var item in jsonList)
                                    {
                                        string devName = this.CheckPoint.Find((x) => { return(x == item.DevName); });
                                        if (!string.IsNullOrWhiteSpace(devName) && !string.IsNullOrWhiteSpace(item.DevName))
                                        {
                                            graph.PointDisplay(GISPlatformCenter.Mapobj, item.PointName);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            SetState(node, 0);

                            SetStateS(node.ParentNode, 0);

                            GetCheckNode(treeList1);
                            if (jsonList != null && jsonList.Count > 0)
                            {
                                if (this.treeList1.Nodes[0].StateImageIndex == 1)
                                {
                                    foreach (var item in jsonList)
                                    {
                                        graph.PointDisplay(GISPlatformCenter.Mapobj, item.PointName);
                                    }
                                }
                                else
                                {
                                    foreach (var item in jsonList)
                                    {
                                        string devName = this.CheckPoint.Find((x) => { return(x == item.DevName); });
                                        if (string.IsNullOrWhiteSpace(devName) && !string.IsNullOrWhiteSpace(item.DevName))
                                        {
                                            graph.PointHidden(GISPlatformCenter.Mapobj, item.PointName);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }