From 9d65c293924e4edbbc8c6c6091f55d7fc49c23eb Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 06 七月 2021 13:15:46 +0800
Subject: [PATCH] 乐橙子账号token
---
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs | 140 +++++++++++++++++++---------------------------
1 files changed, 59 insertions(+), 81 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs
index cee7417..25a6f44 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs
@@ -29,61 +29,51 @@
{
btnOption.MouseUpEventHandler = (sender, e) =>
{
- if (btnOption.TextID == StringId.Save)
+ Action action = () =>
{
- if (string.IsNullOrEmpty(room.name))
+ var waitPage = new Loading();
+ waitPage.Start();
+ new Thread(() =>
{
- new Tip()
+ try
{
- CloseTime = 1,
- Text = Language.StringByID(StringId.RoomNameCannotBeEmpty),
- Direction = AMPopTipDirection.None,
- }.Show(bodyView);
- return;
- }
- if (string.IsNullOrEmpty(room.floorName))
- {
- new Tip()
- {
- CloseTime = 1,
- Text = Language.StringByID(StringId.PlsBindFloor),
- Direction = AMPopTipDirection.None,
- }.Show(bodyView);
- return;
- }
- foreach (var tempRoom in DB_ResidenceData.rooms)
- {
- if (room.name == tempRoom.name)
- {
- new PublicAssmebly().TipMsg(StringId.Tip, StringId.AddingFailed_RoomAlreadyExists);
- return;
- }
- }
- DB_ResidenceData.rooms.Add(room);
- room.SaveRoomData();
- backAction();
- this.RemoveFromParent();
- }
- if (btnOption.TextID == StringId.DeleteRoom)
- {
- Action action = () =>
- {
- foreach (var f in DB_ResidenceData.functionList.GetAllFunction())
- {
- if (f.roomIds.Contains(room.sid))
+ var delResult = SpatialInfo.CurrentSpatial.DelRoom(room);
+ if (delResult == StateCode.SUCCESS)
{
- f.roomIds.Remove(room.sid);
+ 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();
+ });
}
}
- DB_ResidenceData.DelRoom(room);
- //鍒犻櫎浜嬩欢鍥炶皟
- this.deleteAction?.Invoke();
- this.RemoveFromParent();
- };
- new PublicAssmebly().TipMsg(StringId.Tip, StringId.DeleteRoomTip, action);
+ 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>
/// 鏄剧ず鑳屾櫙鍥鹃�夋嫨閫夐」
@@ -115,27 +105,17 @@
return;
}
btnRoomName.Text = str;
- room.name = str;
- if (pageTitleId == StringId.EditRoomInfo)
- {
- room.SaveRoomData();
- }
+ room.roomName = str;
+ room.UpdataRoomInfo();
};
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
{
List<string> roomNameList = new List<string>();
- foreach (var rroom in DB_ResidenceData.rooms)
+ foreach (var rroom in SpatialInfo.CurrentSpatial.RoomList)
{
- roomNameList.Add(rroom.name);
+ roomNameList.Add(rroom.roomName);
}
- if (pageTitleId == StringId.AddRoom)
- {
- new PublicAssmebly().LoadDialog_EditParater(StringId.RoomName, room.name, callBack, StringId.RoomNameCannotBeEmpty, StringId.RoomNameAlreadyExists, roomNameList);
- }
- else
- {
- new PublicAssmebly().LoadDialog_EditParater(StringId.RoomName, room.name, callBack, StringId.RoomNameCannotBeEmpty, StringId.EidtFailed_RoomAlreadyExists, roomNameList);
- }
+ new PublicAssmebly().LoadDialog_EditParater(StringId.RoomName, room.roomName, callBack, StringId.RoomNameCannotBeEmpty, StringId.EidtFailed_RoomAlreadyExists, roomNameList);
};
btnEditRoomNameIcon.MouseUpEventHandler = eventHandler;
roomNameRow.MouseUpEventHandler = eventHandler;
@@ -152,10 +132,11 @@
Action floorsCallBackAction = () =>
{
btnFloorInfo.Text = room.floorName;
+ room.UpdataRoomInfo();
};
- var residentialManagePage = new FloorsManagementPage(floorsCallBackAction);
+ var residentialManagePage = new RoomBinglingFloorPage(floorsCallBackAction, room);
MainPage.BasePageView.AddChidren(residentialManagePage);
- residentialManagePage.LoadPage(room, StringId.FloorAssignment);
+ residentialManagePage.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
btnFloorInfo.MouseUpEventHandler = eventHandler;
@@ -270,13 +251,13 @@
//鎴块棿榛樿鍥惧簱
btnDefaultGallery.MouseUpEventHandler = (sender, e) => {
pictureOptionView.Parent.RemoveFromParent();
- Action<string> action = (obj) => {
+ Action<string> action = (obj) =>
+ {
room.backgroundImage = obj;
+ btnRoomBg.ImageBytes = null;//瑙e喅鏈塈mageBytes涓嶅姞杞絀magePath
btnRoomBg.ImagePath = room.backgroundImage;
- if (pageTitleId == StringId.EditRoomInfo)
- {
- room.SaveRoomData();
- }
+ room.UpdataRoomInfo();
+ modifyImageAction?.Invoke();
};
var galleryPage = new RoomGalleryPage(room.backgroundImage, action);
@@ -303,11 +284,8 @@
{
//2020-12-03 闇�瑕佽鏈�鏂扮殑鍥剧墖璺緞鍚屾鍒颁簯绔�
room.backgroundImage = imageUrl;
- if (pageTitleId == StringId.EditRoomInfo)
- {
- room.SaveRoomData();
-
- }
+ room.UpdataRoomInfo();
+ modifyImageAction?.Invoke();
};
//涓婁紶鍥剧墖鍒颁簯绔�
UploadImage(selectImagePath, btnRoomBg, room, uploadSuccessAction);
@@ -323,7 +301,7 @@
{
try
{
- MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + selectImagePath);
+ //MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + selectImagePath);
//1.璇诲彇瑁佸壀鍚庣殑鍥剧墖锛岀劧鍚庡垹闄�
var imageBytes = Shared.IO.FileUtils.ReadFile(selectImagePath);
System.IO.File.Delete(selectImagePath);
@@ -336,12 +314,12 @@
{
try
{
- var newImageName = mRoom.name.Trim() + ".png";
+ var newImageName = mRoom.roomName.Trim() + ".png";
var uploadImageObj = new UploadImageObj()
{
- prefix = "ONR",
+ prefix = "Room" + Utlis.GetTimestamp(),
fileName = newImageName,
- uid = mRoom.sid,
+ uid = mRoom.uid,
content = imageBytes,
};
@@ -351,15 +329,15 @@
//涓婁紶鎴愬姛
Application.RunOnMainThread(() =>
{
- Utlis.WriteLine("涓婁紶鎴愬姛锛�" + imageUrl);
+ //Utlis.WriteLine("涓婁紶鎴愬姛锛�" + imageUrl);
//1.2濡傛灉鏄嚜瀹氫箟鍥剧墖鍒犻櫎涔嬪墠鐨�
- if (!imageView.ImagePath.Contains("Classification/Room/Roombg"))
+ if (!string.IsNullOrEmpty(imageView.ImagePath) && !imageView.ImagePath.Contains("Classification/Room/Roombg"))
{
- Utlis.WriteLine("鍒犻櫎: " + imageView.ImagePath);
+ //Utlis.WriteLine("鍒犻櫎: " + imageView.ImagePath);
System.IO.File.Delete(imageView.ImagePath);
}
//閲嶅懡鍚嶄繚瀛�
- FileUtils.WriteFileByBytes(imageUrl, imageBytes);
+ ImageUtlis.Current.WriteFileByBytes(imageUrl, imageBytes);
imageView.ImagePath = null;
imageView.ImageBytes = imageBytes;
//涓婁紶鎴愬姛
--
Gitblit v1.8.0