wxr
2021-07-01 adc150efb13a0506f45a3c344c3ee2ef2dba8e90
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs
@@ -31,24 +31,49 @@
            {
                Action action = () =>
                {
                    var delResult = SpatialInfo.CurrentSpatial.DelRoom(room);
                    if (delResult == StateCode.SUCCESS)
                    var waitPage = new Loading();
                    waitPage.Start();
                    new Thread(() =>
                    {
                        foreach (var f in FunctionList.List.GetDeviceFunctionList())
                        try
                        {
                            if (f.roomIds.Contains(room.roomId))
                            var delResult = SpatialInfo.CurrentSpatial.DelRoom(room);
                            if (delResult == StateCode.SUCCESS)
                            {
                                f.roomIds.Remove(room.roomId);
                                foreach (var f in FunctionList.List.GetDeviceFunctionList())
                                {
                                    if (f.roomIds.Contains(room.roomId))
                                    {
                                        f.roomIds.Remove(room.roomId);
                                    }
                                }
                                Application.RunOnMainThread(() =>
                                {
                                    //删除事件回调
                                    this.deleteAction?.Invoke();
                                    this.RemoveFromParent();
                                });
                            }
                        }
                        //删除事件回调
                        this.deleteAction?.Invoke();
                        this.RemoveFromParent();
                    }
                        catch (Exception ex)
                        {
                            MainPage.Log($"添加房间失败msg:{ex.Message}");
                        }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                waitPage.Hide();
                                waitPage.RemoveFromParent();
                            });
                        }
                    })
                    { IsBackground = true }.Start();
                };
                new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DeleteRoomTip, action);
            };
        }
        /// <summary>
        /// 显示背景图选择选项
@@ -81,7 +106,7 @@
                }
                btnRoomName.Text = str;
                room.roomName = str;
                room.SaveRoomData();
                room.UpdataRoomInfo();
            };
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
@@ -107,7 +132,7 @@
                Action floorsCallBackAction = () =>
                {
                    btnFloorInfo.Text = room.floorName;
                    room.SaveRoomData();
                    room.UpdataRoomInfo();
                };
                var residentialManagePage = new RoomBinglingFloorPage(floorsCallBackAction, room);
                MainPage.BasePageView.AddChidren(residentialManagePage);
@@ -229,8 +254,10 @@
                Action<string> action = (obj) =>
                {
                    room.backgroundImage = obj;
                    btnRoomBg.ImageBytes = null;//解决有ImageBytes不加载ImagePath
                    btnRoomBg.ImagePath = room.backgroundImage;
                    room.SaveRoomData();
                    room.UpdataRoomInfo();
                    modifyImageAction?.Invoke();
                };
                var galleryPage = new RoomGalleryPage(room.backgroundImage, action);
@@ -257,7 +284,8 @@
            {
                //2020-12-03 需要讲最新的图片路径同步到云端
                room.backgroundImage = imageUrl;
                room.SaveRoomData();
                room.UpdataRoomInfo();
                modifyImageAction?.Invoke();
            };
            //上传图片到云端
            UploadImage(selectImagePath, btnRoomBg, room, uploadSuccessAction);