| | |
| | | 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() + ".png"; |
| | | CropImage.TakePicture((imagePath) => |
| | | { |
| | | if (imagePath != null) |
| | | { |
| | | btnRoomBg.ImagePath = imagePath.ToString(); |
| | | room.backgroundImage = btnRoomBg.ImagePath; |
| | | MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | } |
| | | }, pid.ToString(), 16, 9); |
| | | CropImageCallBack(imagePath, imageName); |
| | | }, imageName.ToString(), 17, 9); |
| | | |
| | | if (pageTitleId == StringId.EditRoomInfo) |
| | | { |
| | | room.SaveRoomData(); |
| | |
| | | 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() + ".png"; |
| | | CropImage.SelectPicture((imagePath) => |
| | | { |
| | | if (imagePath != null) |
| | | { |
| | | btnRoomBg.ImagePath = imagePath.ToString(); |
| | | room.backgroundImage = btnRoomBg.ImagePath; |
| | | MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | } |
| | | }, pid.ToString(), 16, 9); |
| | | CropImageCallBack(imagePath, imageName); |
| | | }, imageName, 17, 9); |
| | | |
| | | |
| | | if (pageTitleId == StringId.EditRoomInfo) |
| | | { |
| | | room.SaveRoomData(); |
| | | } |
| | | baseView.RemoveFromParent(); |
| | | |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="imagePath"></param> |
| | | /// <param name="imageName"></param> |
| | | void CropImageCallBack(string imagePath, string imageName) |
| | | { |
| | | if (string.IsNullOrEmpty(imagePath) == true) |
| | | { |
| | | return; |
| | | } |
| | | //如果是自定义图片删除之前的 |
| | | if (!btnRoomBg.ImagePath.Contains("Room")) { |
| | | Utlis.WriteLine("删除: " + btnRoomBg.ImagePath); |
| | | System.IO.File.Delete(btnRoomBg.ImagePath); |
| | | } |
| | | |
| | | MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | FileUtils.FileCopyToRootPath(imagePath, imageName); |
| | | System.IO.File.Delete(imagePath); |
| | | //生成图片 |
| | | room.backgroundImage = imageName; |
| | | btnRoomBg.ImagePath = imageName; |
| | | } |
| | | } |
| | | } |