From 6b55721d7123aebfd656c8326ea43115cc46cb43 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 16 十二月 2020 15:11:23 +0800
Subject: [PATCH] 20201216-3

---
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs |   53 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 15 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 e57df22..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,29 +445,52 @@
                         return;
                     }
                 }
-                var addResult = SpatialInfo.CurrentSpatial.AddRoom(room,out 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);
-                    }
-                    if (deviceIds.Count > 0)
-                    {
-                        var bindResult = FunctionList.List.FunctionsBindRooms(new List<string>() { room.roomId }, deviceIds);
-                        if (bindResult == StateCode.SUCCESS)
+                        var addResult = SpatialInfo.CurrentSpatial.AddRoom(room, out room);//妫�鏌oom鏄惁涓轰簯绔繑鍥炵殑鏈�鏂版暟鎹�
+                        if (addResult == StateCode.SUCCESS)
                         {
+                            var deviceIds = new List<string>();
                             foreach (var f in roomFunctions)
                             {
-                                f.roomIds.Add(room.roomId);
+                                deviceIds.Add(f.deviceId);
                             }
-                            room.GetRoomFunctions(true);
+                            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();
+                            });
                         }
                     }
-                    backAction(room);
-                    RemoveFromParent();
-                }
+                    catch (Exception ex)
+                    {
+                        MainPage.Log($"娣诲姞鎴块棿澶辫触msg:{ex.Message}");
+                    }
+                    finally
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            waitPage.Hide();
+                        });
+                    }
+                })
+                { IsBackground = true }.Start();
             };
         }
 

--
Gitblit v1.8.0