public AreaPoints GetPoints(string areaId)
        {
            TEntity    area   = GetEntity(areaId);
            AreaPoints points = new AreaPoints(area);

            return(points);
        }
Exemple #2
0
        private void Tree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            currentArea = ResourceTreeView1.TopoTree.SelectedObject as AreaEntity;
            if (currentArea != null)
            {
                Bll bll         = new Bll();
                var switchAreas = bll.bus_anchor_switch_area.ToList();

                AreaCanvas1.ShowDev = true;
                AreaCanvas1.ShowArea(currentArea, switchAreas);

                AreaListBox1.LoadData(currentArea.Children);
                DeviceListBox1.LoadData(currentArea.LeafNodes);

                ShowPersons();

                ArchorListExportControl1.Clear();
                TabControl1.SelectionChanged -= TabControl1_OnSelectionChanged;
                TabControl1.SelectionChanged += TabControl1_OnSelectionChanged;

                if (TabControl1.SelectedIndex == 2)
                {
                    ArchorListExportControl1.LoadData(currentArea.Id);
                    TabControl1.SelectionChanged -= TabControl1_OnSelectionChanged;
                }
            }
            else
            {
                var dev = ResourceTreeView1.TopoTree.SelectedObject as DevEntity;
                if (dev != null)
                {
                    AreaCanvas1.SelectDevById(dev.Id);
                }
            }
        }
        /// <summary>
        /// 获取树节点
        /// </summary>
        /// <param name="view">0:基本数据;1:设备信息;2:人员信息;3:设备信息+人员信息</param>
        /// <returns></returns>
        public TEntity GetTree(int view)
        {
            TEntity tree = null;

            if (view == 0)
            {
                tree = GetTree();
            }
            else if (view == 1)
            {
                tree = GetTreeWithDev();
            }
            else if (view == 2)
            {
                tree = GetTreeWithPerson();
            }
            else if (view == 3)
            {
                var leafNodes = db.DevInfos.ToList();
                tree = GetTreeWithPerson(leafNodes.ToTModel());
            }
            if (tree != null)
            {
                tree.SetParent();
            }
            string xml    = XmlSerializeHelper.GetXmlText(tree);
            int    length = xml.Length;

            return(tree);
        }
 public Point AddPoint(TEntity area, Point point)
 {
     try
     {
         var bound = GetBound(area);
         if (bound == null)
         {
             return(null);
         }
         point.BoundId = bound.Id;
         //p1.Bound = Bound;
         var  dbPoint = point.ToDbModel();
         bool r       = db.Points.Add(dbPoint);
         if (r)
         {
             point.Id = dbPoint.Id;
             bound.AddPoint(point);
             return(point);
         }
         else
         {
             return(null);
         }
     }
     catch (System.Exception ex)
     {
         Log.Error(tag, "AddPoint", ex.ToString());
         return(null);
     }
 }
 private void RemoveArea(AreaEntity area)
 {
     if (area.Children == null)
     {
         area.Children = areaService.GetListByPid(area.Id + "");
     }
     if (area.Children != null && area.Children.Count > 0)
     {
         MessageBox.Show("存在子区域,不能删除!");
     }
     if (area.LeafNodes == null)
     {
         area.LeafNodes = devService.GetListByPid(area.Id + "");
     }
     if (area.LeafNodes != null && area.LeafNodes.Count > 0)
     {
         MessageBox.Show("存在子设备,不能删除!");
     }
     if (MessageBox.Show("确认删除区域:" + area.Name + "?", "警告", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         var r = areaService.Delete(area.Id + "");
         if (r == null)
         {
             MessageBox.Show("删除失败");
         }
         else
         {
             AreaCanvas1.RemoveArea(area.Id);
         }
     }
 }
        public TEntity Put(TEntity item)
        {
            var dbItem = item.ToDbModel();
            var result = dbSet.Edit(dbItem);

            return(result ? dbItem.ToTModel() : null);
        }
        /// <summary>
        /// 获取树节点
        /// </summary>
        /// <param name="view">0:基本数据;1:设备信息;2:人员信息;3:设备信息+人员信息</param>
        /// <returns></returns>
        public TEntity GetTree(int view)
        {
            TEntity tree = null;

            if (view == 0)
            {
                tree = GetTree();
            }
            else if (view == 1)
            {
                tree = GetTreeWithDev();
            }
            else if (view == 2)
            {
                tree = GetTreeWithPerson();
            }
            else if (view == 3)
            {
                var leafNodes = db.DevInfos.ToList();
                tree = GetTreeWithPerson(leafNodes.ToTModel());
            }
            if (tree != null)
            {
                tree.SetParent();
            }
            return(tree);
        }
        public TEntity Post(string pid, TEntity item)
        {
            item.ParentId = pid.ToInt();
            var dbItem = item.ToDbModel();
            var result = dbSet.Add(dbItem);

            return(result ? dbItem.ToTModel() : null);
        }
        /// <summary>
        /// 获取树节点
        /// </summary>
        /// <param name="view">0:基本数据;1:设备信息;2:人员信息;3:设备信息+人员信息;4:1+CAD</param>
        /// <returns></returns>
        public TEntity GetTree(int view)
        {
            try
            {
                showHidePerson = false;//隐藏待机的人员

                TEntity tree = null;
                if (view == 0)
                {
                    tree = GetTree();
                }
                else if (view == 1)
                {
                    tree = GetTreeWithDev();
                }
                else if (view == 4)
                {
                    tree = GetTreeWithDev(true);
                }
                else if (view == 2)
                {
                    tree = GetTreeWithPerson();
                }
                else if (view == 3)
                {
                    var leafNodes = db.DevInfos.ToList();
                    tree = GetTreeWithPerson(leafNodes.ToTModel());
                }

                else
                {
                    Log.Error("GetTree View=" + view);
                }
                if (tree != null)
                {
                    tree.SetParent();
                }
                if (tree != null)
                {
                    //string xml = XmlSerializeHelper.GetXmlText(tree);
                    //int length = xml.Length;
                }
                else
                {
                    Log.Error("GetTree tree == null");
                }
                return(tree);
            }
            catch (System.Exception ex)
            {
                Log.Error(tag, "GetTree", ex.ToString());
                return(null);
            }
        }
 public TEntity Put(TEntity item)
 {
     try
     {
         var dbItem = item.ToDbModel();
         var result = dbSet.Edit(dbItem);
         return(result ? dbItem.ToTModel() : null);
     }
     catch (System.Exception ex)
     {
         Log.Error(tag, "Put", ex.ToString());
         return(null);
     }
 }
 private void ShowRoomPictures(AreaEntity room)
 {
     //if (room.Type == AreaTypes.机房)
     {
         using (Bll bll = new Bll())
         {
             var           areaRoom = bll.Areas.FindById(room.Id);
             var           path     = areaRoom.GetPath(AreaTypes.楼层, "_");
             var           dirPath2 = AppDomain.CurrentDomain.BaseDirectory + "\\RoomPictures\\" + path;
             DirectoryInfo dirInfo2 = new DirectoryInfo(dirPath2);
             PictureViewer1.Show(dirInfo2);
         }
     }
 }
 public AreaPoints GetPoints(string areaId)
 {
     try
     {
         TEntity    area   = GetEntity(areaId);
         AreaPoints points = new AreaPoints(area);
         return(points);
     }
     catch (System.Exception ex)
     {
         Log.Error(tag, "GetPoints", ex.ToString());
         return(null);
     }
 }
Exemple #13
0
        public Bound GetBound(TEntity area)
        {
            if (area.InitBound != null)
            {
                return(area.InitBound);
            }
            var  bound = new DbModel.Location.AreaAndDev.Bound();
            bool r1    = db.Bounds.Add(bound);

            area.InitBoundId = bound.Id;
            var newArea = new AreaService().Put(area);

            area.InitBound = bound.ToTModel();
            return(area.InitBound);
        }
 public TEntity Post(string pid, TEntity item)
 {
     try
     {
         item.ParentId = pid.ToInt();
         var dbItem = item.ToDbModel();
         var result = dbSet.Add(dbItem);
         return(result ? dbItem.ToTModel() : null);
     }
     catch (System.Exception ex)
     {
         Log.Error(tag, "Post", ex.ToString());
         return(null);
     }
 }
Exemple #15
0
        public List <AreaPoints> GetPointsByPid(string pid)
        {
            var areas = GetListByPid(pid);

            if (areas == null)
            {
                return(null);
            }
            List <AreaPoints> list = new List <AreaPoints>();

            for (int i = 0; i < areas.Count; i++)
            {
                TEntity    area   = areas[i];
                AreaPoints points = new AreaPoints(area);
                list.Add(points);
            }
            return(list);
        }
 public Bound GetBound(TEntity area)
 {
     try
     {
         if (area.InitBound != null)
         {
             return(area.InitBound);
         }
         var  bound = new DbModel.Location.AreaAndDev.Bound();
         bool r1    = db.Bounds.Add(bound);
         area.InitBoundId = bound.Id;
         var newArea = new AreaService().Put(area);
         area.InitBound = bound.ToTModel();
         return(area.InitBound);
     }
     catch (System.Exception ex)
     {
         Log.Error(tag, "GetBound", ex.ToString());
         return(null);
     }
 }
 public List <AreaPoints> GetPointsByPid(string pid)
 {
     try
     {
         var areas = GetListByPid(pid);
         if (areas == null)
         {
             return(null);
         }
         List <AreaPoints> list = new List <AreaPoints>();
         for (int i = 0; i < areas.Count; i++)
         {
             TEntity    area   = areas[i];
             AreaPoints points = new AreaPoints(area);
             list.Add(points);
         }
         return(list);
     }
     catch (System.Exception ex)
     {
         Log.Error(tag, "GetPointsByPid", ex.ToString());
         return(null);
     }
 }
 private void Win_AreaModified(AreaEntity obj)
 {
     LoadData();
     if (obj.LeafNodes != null)
     {
         foreach (DevEntity leaf in obj.LeafNodes)
         {
             if (leaf.TypeName == "基站")
             {
                 var    newDevRect = AreaCanvas1.GetDev(leaf.Id);
                 Window wnd        = SetDevInfo(newDevRect, newDevRect.Tag as DevEntity, false);
                 if (wnd is RoomArchorSettingWindow)
                 {
                     (wnd as RoomArchorSettingWindow).SaveInfo(false);
                 }
                 if (wnd is ParkArchorSettingWindow)
                 {
                     (wnd as ParkArchorSettingWindow).SaveInfo(false);
                 }
                 //wnd.Close();
             }
         }
     }
 }
Exemple #19
0
        public Point AddPoint(TEntity area, Point point)
        {
            var bound = GetBound(area);

            if (bound == null)
            {
                return(null);
            }
            point.BoundId = bound.Id;
            //p1.Bound = Bound;
            var  dbPoint = point.ToDbModel();
            bool r       = db.Points.Add(dbPoint);

            if (r)
            {
                point.Id = dbPoint.Id;
                bound.AddPoint(point);
                return(point);
            }
            else
            {
                return(null);
            }
        }
 public TEntity Put(TEntity item)
 {
     return(service.Put(item));
 }
 public TEntity Post(string pid, TEntity item)
 {
     return(service.Post(pid, item));
 }
 private void AreaListBox1_SelectedItemChanged(AreaEntity obj)
 {
     AreaCanvas1.SelectArea(obj);
 }
        private void InitTopoTreeAreaMenu(WPFClientControlLib.TopoTreeView topoTree)
        {
            topoTree.AreaMenu = new ContextMenu();
            topoTree.AreaMenu.AddMenu("添加区域", (obj) =>
            {
                var area            = topoTree.SelectedObject as AreaEntity;
                var win             = new NewAreaWindow(area, 0);
                win.ShowPointEvent += (x, y) =>
                {
                    AreaCanvas1.ShowPoint(x, y);
                };
                if (win.ShowDialog() == true)
                {
                    var newArea = win.NewArea;
                    area.AddChild(newArea.ToTModel());
                    topoTree.RefreshCurrentNode <AreaEntity, DevEntity>(area);
                    AreaCanvas1.Refresh();
                }
            });

            topoTree.AreaMenu.AddMenu("添加区域(柱子)", (obj) =>
            {
                var area            = topoTree.SelectedObject as AreaEntity;
                var win             = new NewAreaWindow(area, 1);
                win.ShowPointEvent += (x, y) =>
                {
                    AreaCanvas1.ShowPoint(x, y);
                };
                if (win.ShowDialog() == true)
                {
                    var newArea = win.NewArea;
                    area.AddChild(newArea.ToTModel());
                    topoTree.RefreshCurrentNode <AreaEntity, DevEntity>(area);
                    AreaCanvas1.Refresh();
                }
            });
            topoTree.AreaMenu.AddMenu("设置区域", (tag) =>
            {
                var area = topoTree.SelectedObject as AreaEntity;
                ShowAreaInfo(area);
            });
            topoTree.AreaMenu.AddMenu("删除区域", (tag) =>
            {
                var area = topoTree.SelectedObject as AreaEntity;
                RemoveArea(area);
            });
            topoTree.AreaMenu.AddMenu("添加基站", (tag) =>
            {
                var area = topoTree.SelectedObject as AreaEntity;

                var archor      = new TArchor();
                archor.X        = 10;
                archor.Y        = 10;
                archor.Name     = "NewArchor";
                archor.Code     = "";
                archor.Ip       = "";
                archor.ParentId = area.Id;
                var archorNew   = archorService.Post(archor);
                archorNew.Code  = "Code_" + archorNew.Id;
                archorService.Put(archorNew);

                area.AddLeaf(archorNew.DevInfo);

                topoTree.RefreshCurrentNode <AreaEntity, DevEntity>(area);
                AreaCanvas1.Refresh();
            });
            //topoTree.AreaMenu.AddMenu("调整子区域坐标", (tag) =>
            //{
            //    var area = topoTree.SelectedObject as AreaEntity;
            //    var bound = area.InitBound;
            //    var x = bound.MinX;
            //    var y = bound.MinY;
            //    var boundList = new List<Bound>();
            //    foreach (var subArea in area.Children)
            //    {
            //        var subBound = subArea.InitBound;
            //        if (subBound != null)
            //        {
            //            var points = subBound.Points;
            //            if (points != null)
            //            {
            //                foreach (var point in points)
            //                {
            //                    point.X -= x;
            //                    point.Y -= y;
            //                }
            //                bll.Points.EditRange(points.ToDbModel());
            //            }
            //            subBound.SetMinMaxXY();
            //            boundList.Add(subBound);
            //        }
            //    }
            //    bll.Bounds.EditRange(boundList.ToDbModel());
            //});

            topoTree.AreaMenu.AddMenu("复制结构", (tag) =>
            {
                var area = topoTree.SelectedObject as AreaEntity;

                var area1 = areaService.GetEntity("240", true);

                area.InitBound.SetMinMaxXY();
                bll.Bounds.Edit(area.InitBound.ToDbModel());

                var children = area1.Children.CloneObjectList().ToList();

                var newBounds = new List <Bound>();
                foreach (var item in children)
                {
                    if (item.InitBound.Points == null)
                    {
                        item.InitBound.Points = bll.Points.FindAll(i => i.BoundId == item.Id).ToTModel();
                    }
                    newBounds.Add(item.InitBound);
                }

                var dbBounds = newBounds.ToDbModel();
                bll.Bounds.AddRange(dbBounds);
                for (int i = 0; i < children.Count; i++)
                {
                    AreaEntity item  = children[i];
                    item.ParentId    = area.Id;
                    item.InitBoundId = dbBounds[i].Id;
                }
                foreach (var item in dbBounds)
                {
                    var points = item.Points.CloneObjectList();
                    foreach (var point in points)
                    {
                        point.BoundId = item.Id;
                    }
                    bll.Points.AddRange(points);
                }
                var dbChildren = children.ToDbModel();
                bll.Areas.AddRange(dbChildren);

                var devs = area1.LeafNodes.CloneObjectList().ToList();;
                foreach (var item in devs)
                {
                    item.ParentId  = area.Id;
                    item.Code      = "";
                    item.IP        = "";
                    item.DevDetail = bll.Archors.Find(i => i.DevInfoId == item.Id).ToTModel();
                }
                var dbDevs = devs.ToDbModel();
                bll.DevInfos.AddRange(dbDevs);


                var archors = new List <TModel.Location.AreaAndDev.Archor>();
                for (int i = 0; i < devs.Count; i++)
                {
                    DevEntity dev    = devs[i];
                    var archor       = dev.DevDetail as TModel.Location.AreaAndDev.Archor;
                    archor.Code      = "";
                    archor.Ip        = "";
                    archor.ParentId  = area.Id;
                    archor.DevInfoId = dbDevs[i].Id;
                    archors.Add(archor);
                }
                bll.Archors.AddRange(archors.ToDbModel());
                topoTree.RefreshCurrentNode <AreaEntity, DevEntity>(area);
                AreaCanvas1.Refresh();
            });
        }
Exemple #24
0
        private void LoadAreaTree()
        {
            var tree = areaService.GetTree(1);

            if (tree == null)
            {
                return;
            }
            var devList    = tree.GetAllDev();
            var archorList = archorService.GetList();

            foreach (var dev in devList)
            {
                if (archorList != null)
                {
                    dev.DevDetail = archorList.FirstOrDefault(i => i.DevInfoId == dev.Id);
                }
            }
            var topoTree = ResourceTreeView1.TopoTree;

            topoTree.AreaMenu = new ContextMenu();
            topoTree.AreaMenu.AddMenu("添加区域", (obj) =>
            {
                var area            = topoTree.SelectedObject as AreaEntity;
                var win             = new NewAreaWindow(area);
                win.ShowPointEvent += (x, y) =>
                {
                    AreaCanvas1.ShowPoint(x, y);
                };
                if (win.ShowDialog() == true)
                {
                    var newArea = win.NewArea;
                    area.AddChild(newArea.ToTModel());
                    topoTree.RefreshCurrentNode <AreaEntity, DevEntity>(area);
                    AreaCanvas1.Refresh();
                }
            });
            topoTree.AreaMenu.AddMenu("设置区域", (tag) =>
            {
                var area = topoTree.SelectedObject as AreaEntity;
                ShowAreaInfo(area);
            });
            topoTree.AreaMenu.AddMenu("删除区域", (tag) =>
            {
                var area = topoTree.SelectedObject as AreaEntity;
                RemoveArea(area);
            });
            topoTree.AreaMenu.AddMenu("添加基站", (tag) =>
            {
                var area = topoTree.SelectedObject as AreaEntity;

                var archor      = new TArchor();
                archor.X        = 10;
                archor.Y        = 10;
                archor.Name     = "NewArchor";
                archor.Code     = "";
                archor.Ip       = "";
                archor.ParentId = area.Id;
                var archorNew   = archorService.Post(archor);
                archorNew.Code  = "Code_" + archorNew.Id;
                archorService.Put(archorNew);

                area.AddLeaf(archorNew.DevInfo);

                topoTree.RefreshCurrentNode <AreaEntity, DevEntity>(area);
                AreaCanvas1.Refresh();
            });
            //topoTree.AreaMenu.AddMenu("调整子区域坐标", (tag) =>
            //{
            //    var area = topoTree.SelectedObject as AreaEntity;
            //    var bound = area.InitBound;
            //    var x = bound.MinX;
            //    var y = bound.MinY;
            //    var boundList = new List<Bound>();
            //    foreach (var subArea in area.Children)
            //    {
            //        var subBound = subArea.InitBound;
            //        if (subBound != null)
            //        {
            //            var points = subBound.Points;
            //            if (points != null)
            //            {
            //                foreach (var point in points)
            //                {
            //                    point.X -= x;
            //                    point.Y -= y;
            //                }
            //                bll.Points.EditRange(points.ToDbModel());
            //            }
            //            subBound.SetMinMaxXY();
            //            boundList.Add(subBound);
            //        }
            //    }
            //    bll.Bounds.EditRange(boundList.ToDbModel());
            //});

            topoTree.AreaMenu.AddMenu("复制结构", (tag) =>
            {
                var area = topoTree.SelectedObject as AreaEntity;

                var area1 = areaService.GetEntity("240", true);

                area.InitBound.SetMinMaxXY();
                bll.Bounds.Edit(area.InitBound.ToDbModel());

                var children = area1.Children.CloneObjectList().ToList();

                var newBounds = new List <Bound>();
                foreach (var item in children)
                {
                    if (item.InitBound.Points == null)
                    {
                        item.InitBound.Points = bll.Points.FindAll(i => i.BoundId == item.Id).ToTModel();
                    }
                    newBounds.Add(item.InitBound);
                }

                var dbBounds = newBounds.ToDbModel();
                bll.Bounds.AddRange(dbBounds);
                for (int i = 0; i < children.Count; i++)
                {
                    AreaEntity item  = children[i];
                    item.ParentId    = area.Id;
                    item.InitBoundId = dbBounds[i].Id;
                }
                foreach (var item in dbBounds)
                {
                    var points = item.Points.CloneObjectList();
                    foreach (var point in points)
                    {
                        point.BoundId = item.Id;
                    }
                    bll.Points.AddRange(points);
                }
                var dbChildren = children.ToDbModel();
                bll.Areas.AddRange(dbChildren);

                var devs = area1.LeafNodes.CloneObjectList().ToList();;
                foreach (var item in devs)
                {
                    item.ParentId  = area.Id;
                    item.Code      = "";
                    item.IP        = "";
                    item.DevDetail = bll.Archors.Find(i => i.DevInfoId == item.Id).ToTModel();
                }
                var dbDevs = devs.ToDbModel();
                bll.DevInfos.AddRange(dbDevs);


                var archors = new List <TModel.Location.AreaAndDev.Archor>();
                for (int i = 0; i < devs.Count; i++)
                {
                    DevEntity dev    = devs[i];
                    var archor       = dev.DevDetail as TModel.Location.AreaAndDev.Archor;
                    archor.Code      = "";
                    archor.Ip        = "";
                    archor.ParentId  = area.Id;
                    archor.DevInfoId = dbDevs[i].Id;
                    archors.Add(archor);
                }
                bll.Archors.AddRange(archors.ToDbModel());


                //var archor = new TArchor();
                //archor.X = 10;
                //archor.Y = 10;
                //archor.Name = "NewArchor";
                //archor.Code = "";
                //archor.Ip = "";
                //archor.ParentId = area.Id;
                //var archorNew = archorService.Post(archor);
                //archorNew.Code = "Code_" + archorNew.Id;
                //archorService.Put(archorNew);

                //area.AddLeaf(archorNew.DevInfo);

                topoTree.RefreshCurrentNode <AreaEntity, DevEntity>(area);
                AreaCanvas1.Refresh();
            });

            topoTree.DevMenu = new ContextMenu();
            topoTree.DevMenu.AddMenu("设置设备", (tag) =>
            {
                var dev = topoTree.SelectedObject as DevEntity;
                SetDevInfo(null, dev);
            });
            topoTree.DevMenu.AddMenu("基站配置", (tag) =>
            {
                //var dev = topoTree.SelectedObject as DevEntity;
                //SetDevInfo(null, dev);
            });
            topoTree.DevMenu.AddMenu("删除设备", (tag) =>
            {
                var dev = topoTree.SelectedObject as DevEntity;
                RemoveDev(dev);
            });

            topoTree.LoadDataEx <AreaEntity, DevEntity>(tree);
            topoTree.Tree.SelectedItemChanged += Tree_SelectedItemChanged;
            topoTree.ExpandLevel(2);


            if (_archors != null)
            {
                List <int> ids = new List <int>();
                foreach (var archor in _archors)
                {
                    topoTree.SelectNode((int)archor.ParentId, archor.DevInfoId);
                    ids.Add(archor.DevInfoId);
                }
                AreaCanvas1.SelectDevsById(ids);
            }
            else
            {
                topoTree.SelectFirst();
            }
        }
        private void RemoveAreaDevs(AreaEntity area)
        {
            if (area.LeafNodes == null)
            {
                area.LeafNodes = devService.GetListByPid(area.Id + "");
            }

            List <DevEntity> devs = new List <DevEntity>();

            //List<DevEntity> devs2 = new List<DevEntity>();
            if (area.Type == AreaTypes.机房)
            {
                var parent = area.Parent;
                if (parent == null)
                {
                    parent = areaService.GetParent(area.Id + "");
                }
                var devs2 = parent.LeafNodes;
                if (devs2 == null)
                {
                    devs2 = devService.GetListByPid(parent.Id + "");
                }
                foreach (var item in devs2)
                {
                    if (area.InitBound.Contains(item.Pos.PosX, item.Pos.PosZ))
                    {
                        devs.Add(item);
                    }
                }
            }
            else if (area.Type == AreaTypes.楼层)
            {
                var devs2 = area.LeafNodes;
                if (devs2 == null)
                {
                    devs2 = devService.GetListByPid(area.Id + "");
                }
                foreach (var item in devs2)
                {
                    if (area.InitBound.Contains(item.Pos.PosX, item.Pos.PosZ))
                    {
                        devs.Add(item);
                    }
                }
            }

            //var devs=devService.GetListByBound(area.InitBound);
            AreaCanvas1.SelectDevs(devs);
            if (MessageBox.Show(string.Format("确认删除区域'{0}'内{1}个设备?", area.Name, devs.Count), "警告", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                foreach (var dev in devs)
                {
                    var r = devService.Delete(dev.Id + "");
                    if (r == null)
                    {
                        MessageBox.Show("删除失败:" + dev.Name);
                    }
                    AreaCanvas1.RemoveDev(dev.Id);
                }
            }
            else
            {
                AreaCanvas1.ClearSelect();
            }
        }