| | |
| | | /// <summary> |
| | | /// backGround |
| | | /// </summary> |
| | | private Button backGround; |
| | | private ImageView backGround; |
| | | /// <summary> |
| | | /// IconPathType |
| | | /// </summary> |
| | |
| | | room = r; |
| | | IconPathType = r.BackgroundImageType; |
| | | OldIconPathType= r.BackgroundImageType; |
| | | if (IconPathType != 1) |
| | | if (IconPathType != 0) |
| | | { |
| | | OldBackgroundImagePath = r.BackgroundImage; |
| | | } |
| | |
| | | }; |
| | | AddChidren(bodyFrameLayout); |
| | | |
| | | backGround = new Button() |
| | | backGround = new ImageView() |
| | | { |
| | | Y = Application.GetRealHeight(60), |
| | | Width = Application.GetMinRealAverage(887), |
| | | Height = Application.GetMinRealAverage(444), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius), |
| | | UnSelectedImagePath = room.BackgroundImage |
| | | ImagePath = room.BackgroundImageType == 0 ? room.BackgroundImage : System.IO.Path.Combine(Config.Instance.FullPath, room.BackgroundImage) |
| | | }; |
| | | bodyFrameLayout.AddChidren(backGround); |
| | | backGround.SetViewShadow(true); |
| | | if (room.BackgroundImageType != 0) |
| | | { |
| | | backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(backGround.ImagePath); |
| | | } |
| | | backGround.MouseUpEventHandler += backGroundIMGHander; |
| | | |
| | | var infoFL = new FrameLayout |
| | |
| | | nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.RoomName)} :"); |
| | | nameRow.SetTitle(room.Name); |
| | | infoFL.AddChidren(nameRow); |
| | | if(room.IsLove) |
| | | { |
| | | nameRow.NameText.Enable = false; |
| | | } |
| | | |
| | | var floorRow = new DeviceInfoRow(308); |
| | | floorRow.Init(); |
| | |
| | | var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); |
| | | var fileName = $"RoomIcon_{tradeTime}.png"; |
| | | room.Name = nameRow.NameText.Text.Trim(); |
| | | if (OldIconPathType != 1) |
| | | if (OldIconPathType != 0) |
| | | { |
| | | Shared.IO.FileUtils.DeleteFile(OldBackgroundImagePath); |
| | | Shared.IO.FileUtils.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath,OldBackgroundImagePath)); |
| | | } |
| | | if (IconPathType == 0) |
| | | { |
| | | room.BackgroundImage = backGround.UnSelectedImagePath; |
| | | room.BackgroundImage = backGround.ImagePath; |
| | | } |
| | | else |
| | | { |
| | | Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes); |
| | | room.BackgroundImage = System.IO.Path.Combine(Config.Instance.FullPath, fileName); |
| | | room.BackgroundImage = fileName; |
| | | } |
| | | room.BackgroundImageType = IconPathType; |
| | | room.Save(); |
| | |
| | | { |
| | | IconPathType = 0; |
| | | backGround.ImageBytes = null; |
| | | backGround.UnSelectedImagePath = imgPath; |
| | | backGround.ImagePath = imgPath; |
| | | }; |
| | | }; |
| | | selectPhotographBtn.MouseUpEventHandler += (send, ee) => |
| | |
| | | { |
| | | if (IconPathType != 0) |
| | | { |
| | | Global.DeleteFilebyHomeId(backGround.UnSelectedImagePath); |
| | | Global.DeleteFilebyHomeId(backGround.ImagePath); |
| | | } |
| | | |
| | | IconPathType = 1; |
| | | backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath); |
| | | backGround.UnSelectedImagePath = imagePath; |
| | | backGround.ImagePath = imagePath; |
| | | System.IO.File.Delete(imagePath); |
| | | |
| | | }, fileName, 2, 1); |
| | |
| | | { |
| | | if (IconPathType != 0) |
| | | { |
| | | Global.DeleteFilebyHomeId(backGround.UnSelectedImagePath); |
| | | Global.DeleteFilebyHomeId(backGround.ImagePath); |
| | | } |
| | | |
| | | IconPathType = 2; |
| | | backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath); |
| | | backGround.UnSelectedImagePath = imagePath; |
| | | backGround.ImagePath = imagePath; |
| | | System.IO.File.Delete(imagePath); |
| | | |
| | | }, fileName, 2, 1); |