From a2927467ebfa938a420f392deb6882b35570fd33 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 01 十二月 2020 16:48:06 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/CJL-NEW' --- HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 120 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 96 insertions(+), 24 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs index 00ae5a7..056eb91 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs @@ -740,20 +740,29 @@ { btnTakePicture.IsSelected = false; - var pid = Guid.NewGuid(); + //var pid = Guid.NewGuid(); + //CropImage.TakePicture((imagePath) => + //{ + // if (imagePath != null) + // { + // addSceneImageView.ImagePath = imagePath.ToString(); + // scene.ImagePath = addSceneImageView.ImagePath; + // MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); + // } + //}, pid.ToString(), 4, 3); + + + //var imageName = Guid.NewGuid().ToString(); + var imageName = scene.sid; CropImage.TakePicture((imagePath) => { - if (imagePath != null) - { - addSceneImageView.ImagePath = imagePath.ToString(); - scene.ImagePath = addSceneImageView.ImagePath; - MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); - } - }, pid.ToString(), 4, 3); - if (pageTitleId == StringId.EditScene) - { - scene.SaveSceneData(); - } + CropImageCallBack(imagePath, imageName); + }, imageName, 4, 3); + + //if (pageTitleId == StringId.EditScene) + //{ + // scene.SaveFunctionData(); + //} pictureOptionView.Parent.RemoveFromParent(); }; btnAlbum.MouseDownEventHandler = (sender, e) => { @@ -763,20 +772,30 @@ btnAlbum.MouseUpEventHandler = (sender, e) => { btnAlbum.IsSelected = false; - var pid = Guid.NewGuid(); + //var pid = Guid.NewGuid(); + //CropImage.SelectPicture((imagePath) => + //{ + // if (imagePath != null) + // { + // addSceneImageView.ImagePath = imagePath.ToString(); + // scene.ImagePath = addSceneImageView.ImagePath; + // MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); + // } + //}, pid.ToString(), 4, 3); + + //浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀 + //var imageName = Guid.NewGuid().ToString(); + var imageName = scene.sid; CropImage.SelectPicture((imagePath) => { - if (imagePath != null) - { - addSceneImageView.ImagePath = imagePath.ToString(); - scene.ImagePath = addSceneImageView.ImagePath; - MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); - } - }, pid.ToString(), 4, 3); - if (pageTitleId == StringId.EditScene) - { - scene.SaveSceneData(); - } + CropImageCallBack(imagePath, imageName); + }, imageName, 4, 3); + + + //if (pageTitleId == StringId.EditScene) + //{ + // scene.SaveFunctionData(); + //} pictureOptionView.Parent.RemoveFromParent(); }; @@ -796,6 +815,58 @@ 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 + //1.浣跨敤鏂板悕瀛楋紝瑙e喅鐩稿悓璺緞涓嶅埛鏂板浘鐗囬棶棰� + imageName = Guid.NewGuid().ToString() + ".png"; + //1.2濡傛灉鏄嚜瀹氫箟鍥剧墖鍒犻櫎涔嬪墠鐨� + if (!addSceneImageView.ImagePath.Contains("Gallery/scenebg")) + { + Utlis.WriteLine("鍒犻櫎: " + addSceneImageView.ImagePath); + System.IO.File.Delete(addSceneImageView.ImagePath); + } + //1.3濡傛灉鏄畨鍗撻渶瑕佹嫹璐濆洖鏉PP鏍圭洰褰� + FileUtils.FileCopyToRootPath(imagePath, imageName); + System.IO.File.Delete(imagePath); + MainPage.Log("SelectPicture 鏈�缁堣矾寰�: " + imageName); + mPath = imageName; +#endif + //娓呯┖鍘熸潵鍥剧墖 + addSceneImageView.ImagePath = "NULL"; + addSceneImageView.ImagePath = mPath; + scene.ImagePath = mPath; + + if (pageTitleId == StringId.EditScene) + { + scene.SaveFunctionData(); + } + } + catch + { + + } } @@ -884,5 +955,6 @@ btnEditSceneNameIcon.MouseUpEventHandler = eventHandler; } + } } -- Gitblit v1.8.0