From 4a5e9d0447aae9b264a98ea1f4c95417d0f4aa91 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 01 十二月 2020 17:20:01 +0800 Subject: [PATCH] Merge branch 'master' into WJC --- HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs | 132 +++++++++++++++++++++++++++++++++++-------- 1 files changed, 107 insertions(+), 25 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs index d59d8c0..8cd2f51 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs @@ -39,7 +39,7 @@ }.Show(bodyView); return; } - if(string.IsNullOrEmpty( room.floorName)) + if (string.IsNullOrEmpty(room.floorName)) { new Tip() { @@ -68,9 +68,9 @@ { foreach (var f in DB_ResidenceData.functionList.GetAllFunction()) { - if (f.roomIdList.Contains(room.sid)) + if (f.roomIds.Contains(room.sid)) { - f.roomIdList.Remove(room.sid); + f.roomIds.Remove(room.sid); } } DB_ResidenceData.DelRoom(room); @@ -222,51 +222,133 @@ { baseView.RemoveFromParent(); }; - btnTakePicture.MouseDownEventHandler = (sender, e) => { + btnTakePicture.MouseDownEventHandler = (sender, e) => + { btnTakePicture.IsSelected = true; }; + //鎷嶇収 btnTakePicture.MouseUpEventHandler = (sender, e) => { btnTakePicture.IsSelected = false; - var pid = Guid.NewGuid(); + //var pid = Guid.NewGuid(); + //CropImage.TakePicture((imagePath) => + //{ + // if (imagePath != null) + // { + // btnRoomBg.ImagePath = imagePath.ToString(); + // room.backgroundImage = btnRoomBg.ImagePath; + // MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); + // } + //}, pid.ToString(), 16, 9); + + //var imageName = Guid.NewGuid().ToString(); + var imageName = room.sid; CropImage.TakePicture((imagePath) => { - if (imagePath != null) - { - btnRoomBg.ImagePath = imagePath.ToString(); - room.backgroundImage = btnRoomBg.ImagePath; - MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); - } - }, pid.ToString(), 16, 9); - if (pageTitleId == StringId.EditRoomInfo) - { - room.SaveRoomData(); - } + CropImageCallBack(imagePath, imageName); + + }, imageName, 16, 9); + baseView.RemoveFromParent(); }; - btnAlbum.MouseDownEventHandler = (sender, e) => { + //閫夋嫨鐓х墖 + btnAlbum.MouseDownEventHandler = (sender, e) => + { btnAlbum.IsSelected = true; }; btnAlbum.MouseUpEventHandler = (sender, e) => { btnAlbum.IsSelected = false; - var pid = Guid.NewGuid(); + //var pid = Guid.NewGuid(); + //CropImage.SelectPicture((imagePath) => + //{ + // if (imagePath != null) + // { + // btnRoomBg.ImagePath = imagePath.ToString(); + // room.backgroundImage = btnRoomBg.ImagePath; + // MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); + // } + //}, pid.ToString(), 16, 9); + + //浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀 + //var imageName = Guid.NewGuid().ToString(); + var imageName = room.sid; CropImage.SelectPicture((imagePath) => { - if (imagePath != null) + CropImageCallBack(imagePath, imageName); + + }, imageName, 16, 9); + + baseView.RemoveFromParent(); + + }; + + //鎴块棿榛樿鍥惧簱 + btnDefaultGallery.MouseUpEventHandler = (sender, e) => { + pictureOptionView.Parent.RemoveFromParent(); + Action<string> action = (obj) => { + room.backgroundImage = obj; + btnRoomBg.ImagePath = room.backgroundImage; + if (pageTitleId == StringId.EditRoomInfo) { - btnRoomBg.ImagePath = imagePath.ToString(); - room.backgroundImage = btnRoomBg.ImagePath; - MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); + room.SaveRoomData(); } - }, pid.ToString(), 16, 9); + }; + + var galleryPage = new RoomGalleryPage(room.backgroundImage, action); + MainPage.BasePageView.AddChidren(galleryPage); + galleryPage.LoadPage(true); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + }; + } + + /// <summary> + /// 瑁佸壀瀹岀収鐗囧洖璋冿紝缁熶竴澶勭悊 + /// </summary> + /// <param name="imagePath">瑁佸壀鍚庣殑鐪熷疄璺緞</param> + /// <param name="imageName">鑷畾涔夌殑鍥剧墖鍚嶇О</param> + void CropImageCallBack(string imagePath, string imageName) + { + if (string.IsNullOrEmpty(imagePath) == true) + { + return; + } + try + { + var mPath = imagePath; + MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); +#if __IOS__ + + +#else + //imageName = imageName + ".png"; + + //1.浣跨敤鏂板悕瀛楋紝瑙e喅鐩稿悓璺緞涓嶅埛鏂板浘鐗囬棶棰� + imageName = Guid.NewGuid().ToString() + ".png"; + //1.2濡傛灉鏄嚜瀹氫箟鍥剧墖鍒犻櫎涔嬪墠鐨� + if (!btnRoomBg.ImagePath.Contains("Room")) { + Utlis.WriteLine("鍒犻櫎: " + btnRoomBg.ImagePath); + System.IO.File.Delete(btnRoomBg.ImagePath); + } + //1.3濡傛灉鏄畨鍗撻渶瑕佹嫹璐濆洖鏉PP鏍圭洰褰� + FileUtils.FileCopyToRootPath(imagePath, imageName); + System.IO.File.Delete(imagePath); + mPath = imageName; +#endif + //娓呯┖鍘熸潵鍥剧墖 + btnRoomBg.ImagePath = "NULL"; + //鐢熸垚鍥剧墖 + room.backgroundImage = mPath; + btnRoomBg.ImagePath = mPath; + if (pageTitleId == StringId.EditRoomInfo) { room.SaveRoomData(); } - baseView.RemoveFromParent(); - }; + } + catch { } } } } \ No newline at end of file -- Gitblit v1.8.0