| | |
| | | { |
| | | 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) => { |
| | |
| | | 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(); |
| | | }; |
| | | |
| | |
| | | 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.使用新名字,解决相同路径不刷新图片问题 |
| | | 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如果是安卓需要拷贝回来APP根目录 |
| | | 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 |
| | | { |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | btnEditSceneNameIcon.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |