| | |
| | | return; |
| | | } |
| | | } |
| | | var addResult = SpatialInfo.CurrentSpatial.AddRoom(room,out room);//检查room是否为云端返回的最新数据 |
| | | 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);//检查room是否为云端返回的最新数据 |
| | | 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(); |
| | | }; |
| | | } |
| | | |