| | |
| | | btnFunctionManagementTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(120), |
| | | Width = Application.GetRealWidth(220), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | foreach (var tempRoom in DB_ResidenceData.residenceData.Rooms) |
| | | foreach (var tempRoom in SpatialInfo.CurrentSpatial.RoomList) |
| | | { |
| | | if (room.roomName == tempRoom.roomName) |
| | | { |
| | |
| | | return; |
| | | } |
| | | } |
| | | var addResult = SpatialInfo.CurrentSpatial.AddRoom(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); |
| | | var addResult = SpatialInfo.CurrentSpatial.AddRoom(room, out room);//检查room是否为云端返回的最新数据 |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | List<string> roomNameList = new List<string>(); |
| | | foreach (var temp in DB_ResidenceData.residenceData.Rooms) |
| | | foreach (var temp in SpatialInfo.CurrentSpatial.RoomList) |
| | | { |
| | | roomNameList.Add(temp.roomName); |
| | | } |
| | |
| | | pictureOptionView.Parent.RemoveFromParent(); |
| | | Action<string> action = (obj) => { |
| | | room.backgroundImage = obj; |
| | | btnRoomBg.ImageBytes = null;//解决有ImageBytes不加载ImagePath |
| | | btnRoomBg.ImagePath = room.backgroundImage; |
| | | }; |
| | | |
| | |
| | | { |
| | | //MainPage.Log("SelectPicture 裁剪图片返回路径: " + selectImagePath); |
| | | //1.读取裁剪后的图片,然后删除 |
| | | var imageBytes = Shared.IO.FileUtils.ReadFile(selectImagePath); |
| | | var imageBytes = ImageUtlis.Current.ReadFile(selectImagePath); |
| | | System.IO.File.Delete(selectImagePath); |
| | | |
| | | var waitPage = new Loading(); |
| | |
| | | System.IO.File.Delete(imageView.ImagePath); |
| | | } |
| | | //重命名保存 |
| | | FileUtils.WriteFileByBytes(imageUrl, imageBytes); |
| | | ImageUtlis.Current.WriteFileByBytes(imageUrl, imageBytes); |
| | | imageView.ImagePath = null; |
| | | imageView.ImageBytes = imageBytes; |
| | | //上传成功 |