//private void CreateDevInfo(int areaId,Point point)
        //{
        //    //DevEntity

        //    var area= areaId
        //}

        private Window SetDevInfo(Rectangle rect, DevEntity obj, bool isShow = true)
        {
            var parentArea = areaService.GetEntity(obj.ParentId + "");

            if (parentArea.IsPark()) //电厂
            {
                var bound      = parentArea.InitBound;
                var leftBottom = bound.GetLeftBottomPoint();

                parkArchorSettingWnd             = new ParkArchorSettingWindow();
                ArchorSettingContext.ZeroX       = leftBottom.X;
                ArchorSettingContext.ZeroY       = leftBottom.Y;
                parkArchorSettingWnd.RefreshDev += (dev) => {
                    archorSettings = bll.ArchorSettings.ToList();
                    obj.Refresh(dev);
                    AreaCanvas1.RefreshDev(dev);
                };
                parkArchorSettingWnd.ShowPointEvent += (x, y) => { AreaCanvas1.ShowPoint(x, y); };
                parkArchorSettingWnd.Closed         += (sender, e) => { parkArchorSettingWnd = null; };

                if (isShow)
                {
                    parkArchorSettingWnd.Show();
                }

                if (parkArchorSettingWnd.ShowInfo(rect, obj.Id) == false)
                {
                    parkArchorSettingWnd.Close();
                    parkArchorSettingWnd = null;
                }
                return(parkArchorSettingWnd);
            }
            else
            {
                roomArchorSettingWnd = new RoomArchorSettingWindow();
                //roomArchorSettingWnd.Owner = this;
                roomArchorSettingWnd.RefreshDev += (dev) => {
                    archorSettings = bll.ArchorSettings.ToList();
                    obj.Refresh(dev);
                    AreaCanvas1.RefreshDev(dev);
                };
                roomArchorSettingWnd.ShowPointEvent += (x, y) => { AreaCanvas1.ShowPoint(x, y); };
                roomArchorSettingWnd.Closed         += (sender, e) => { roomArchorSettingWnd = null; };
                if (isShow)
                {
                    roomArchorSettingWnd.Show();
                }
                if (roomArchorSettingWnd.ShowInfo(rect, obj.Id) == false)
                {
                    roomArchorSettingWnd.Close();
                    roomArchorSettingWnd = null;
                }
                return(roomArchorSettingWnd);
            }
        }
Exemplo n.º 2
0
        private void SetDevInfo(Rectangle rect, DevEntity obj)
        {
            var parentArea = areaService.GetEntity(obj.ParentId + "");

            //obj.Parent
            if (parentArea.IsPark()) //电厂
            {
                var bound = parentArea.InitBound;
                //if (bound.Points == null)
                //{
                //    bound.Points = new Bll().Points.FindAll(i => i.BoundId == bound.Id);
                //}
                var leftBottom = bound.GetLeftBottomPoint();

                parkArchorSettingWnd       = new ParkArchorSettingWindow();
                ArchorSettingContext.ZeroX = leftBottom.X;
                ArchorSettingContext.ZeroY = leftBottom.Y;
                //win2.Owner = this;
                parkArchorSettingWnd.RefreshDev += (dev) => {
                    archorSettings = bll.ArchorSettings.ToList();
                    AreaCanvas1.RefreshDev(dev);
                };
                parkArchorSettingWnd.ShowPointEvent += (x, y) => { AreaCanvas1.ShowPoint(x, y); };
                parkArchorSettingWnd.Closed         += (sender, e) => { parkArchorSettingWnd = null; };
                parkArchorSettingWnd.Show();

                if (parkArchorSettingWnd.ShowInfo(rect, obj.Id) == false)
                {
                    parkArchorSettingWnd.Close();
                    parkArchorSettingWnd = null;
                    return;
                }
            }
            else
            {
                roomArchorSettingWnd = new RoomArchorSettingWindow();
                //roomArchorSettingWnd.Owner = this;
                roomArchorSettingWnd.RefreshDev += (dev) => {
                    archorSettings = bll.ArchorSettings.ToList();
                    AreaCanvas1.RefreshDev(dev);
                };
                roomArchorSettingWnd.ShowPointEvent += (x, y) => { AreaCanvas1.ShowPoint(x, y); };
                roomArchorSettingWnd.Closed         += (sender, e) => { roomArchorSettingWnd = null; };
                roomArchorSettingWnd.Show();
                if (roomArchorSettingWnd.ShowInfo(rect, obj.Id) == false)
                {
                    roomArchorSettingWnd.Close();
                    roomArchorSettingWnd = null;
                    return;
                }
            }
        }