From 5eeafe3af80bfd88306bd8ad9e76c8f4b51ca35f Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期四, 17 十二月 2020 14:16:20 +0800 Subject: [PATCH] 增加本地发送的重发机制 --- HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs | 52 +++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 39 insertions(+), 13 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs index b5bc984..fccf6c8 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs @@ -445,26 +445,52 @@ return; } } - var addResult = SpatialInfo.CurrentSpatial.AddRoom(room);//妫�鏌oom鏄惁涓轰簯绔繑鍥炵殑鏈�鏂版暟鎹� - if (addResult == StateCode.SUCCESS) + var waitPage = new Loading(); + waitPage.Start(); + new Thread(() => { - var deviceIds = new List<string>(); - foreach (var f in roomFunctions) + try { - deviceIds.Add(f.deviceId); + var addResult = SpatialInfo.CurrentSpatial.AddRoom(room, out room);//妫�鏌oom鏄惁涓轰簯绔繑鍥炵殑鏈�鏂版暟鎹� + if (addResult == StateCode.SUCCESS) + { + var deviceIds = new List<string>(); + foreach (var f in roomFunctions) + { + deviceIds.Add(f.deviceId); + } + if (deviceIds.Count > 0) + { + var bindResult = FunctionList.List.FunctionsBindRooms(new List<string>() { room.roomId }, deviceIds); + if (bindResult == StateCode.SUCCESS) + { + foreach (var f in roomFunctions) + { + f.roomIds.Add(room.roomId); + } + room.GetRoomFunctions(true); + } + } + Application.RunOnMainThread(() => + { + backAction(room); + RemoveFromParent(); + }); + } } - var bindResult = FunctionList.List.FunctionsBindRooms(new List<string>() { room.roomId }, deviceIds); - if (bindResult == StateCode.SUCCESS) + catch (Exception ex) { - room.GetRoomFunctions(true); + MainPage.Log($"娣诲姞鎴块棿澶辫触msg:{ex.Message}"); } - else + finally { - //Utlis.ShowTip(Language.StringByID(StringId.EditFunctionInfoFail) + "\r\nCode:" + pack.Code); + Application.RunOnMainThread(() => + { + waitPage.Hide(); + }); } - backAction(room); - RemoveFromParent(); - } + }) + { IsBackground = true }.Start(); }; } -- Gitblit v1.8.0