| | |
| | | }).Start(); |
| | | #endregion |
| | | |
| | | //2.注销推送 |
| | | new HttpServerRequest().SignOutPush(); |
| | | //3.跳转登录页面 |
| | | UserInfo.Current.LastTime = DateTime.MinValue; |
| | | UserInfo.Current.SaveUserInfo(); |
| | | MainPage.GoLoginPage(UserInfo.Current); |
| | |
| | | btnTakePicture.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnTakePicture.IsSelected = false; |
| | | var pid = Guid.NewGuid(); |
| | | CropImage.TakePicture((Action<string>)((imagePath) => |
| | | //var pid = Guid.NewGuid(); |
| | | //CropImage.TakePicture((Action<string>)((imagePath) => |
| | | //{ |
| | | // if (imagePath != null) |
| | | // { |
| | | // UserInfo.Current.headImagePagePath = imagePath.ToString(); |
| | | // userHeadImageView.ImagePath = imagePath.ToString(); |
| | | // updataHeadImage(); |
| | | // new System.Threading.Thread(() => |
| | | // { |
| | | // new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath); |
| | | // }) |
| | | // { IsBackground = true }.Start(); |
| | | // UserInfo.Current.SaveUserInfo(); |
| | | // MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | // } |
| | | //}), pid.ToString(), 1, 1); |
| | | |
| | | //拍照裁剪 |
| | | var imageName = "headImage"; |
| | | //var imageName = Guid.NewGuid().ToString(); |
| | | CropImage.TakePicture((imagePath) => |
| | | { |
| | | if (imagePath != null) |
| | | { |
| | | UserInfo.Current.headImagePagePath = imagePath.ToString(); |
| | | userHeadImageView.ImagePath = imagePath.ToString(); |
| | | updataHeadImage(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | UserInfo.Current.SaveUserInfo(); |
| | | MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | } |
| | | }), pid.ToString(), 1, 1); |
| | | CropImageCallBack(imagePath, imageName); |
| | | |
| | | }, imageName, 1, 1); |
| | | |
| | | pictureOptionView.RemoveFromParent(); |
| | | baseView.RemoveFromParent(); |
| | | }; |
| | |
| | | btnAlbum.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnAlbum.IsSelected = false; |
| | | var pid = Guid.NewGuid(); |
| | | //var pid = Guid.NewGuid(); |
| | | //CropImage.SelectPicture((imagePath) => |
| | | //{ |
| | | // if (imagePath != null) |
| | | // { |
| | | // UserInfo.Current.headImagePagePath = imagePath.ToString(); |
| | | // userHeadImageView.ImagePath = imagePath.ToString(); |
| | | // updataHeadImage(); |
| | | |
| | | // new System.Threading.Thread(() => |
| | | // { |
| | | // new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath); |
| | | // }) |
| | | // { IsBackground = true }.Start(); UserInfo.Current.SaveUserInfo(); |
| | | // MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | // } |
| | | //}, pid.ToString(), 1, 1); |
| | | |
| | | //从相册选择图片裁剪 |
| | | //var imageName = Guid.NewGuid().ToString(); |
| | | var imageName = "headImage"; |
| | | CropImage.SelectPicture((imagePath) => |
| | | { |
| | | if (imagePath != null) |
| | | CropImageCallBack(imagePath, imageName); |
| | | }, imageName, 1, 1); |
| | | |
| | | pictureOptionView.RemoveFromParent(); |
| | | baseView.RemoveFromParent(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 裁剪完照片回调,统一处理 |
| | | /// </summary> |
| | | /// <param name="imagePath">裁剪后的真实路径</param> |
| | | /// <param name="imageName">自定义的图片名称</param> |
| | | void CropImageCallBack(string imagePath, string imageName) |
| | | { |
| | | UserInfo.Current.headImagePagePath = imagePath.ToString(); |
| | | userHeadImageView.ImagePath = imagePath.ToString(); |
| | | if (string.IsNullOrEmpty(imagePath) == true) |
| | | { |
| | | return; |
| | | } |
| | | try |
| | | { |
| | | MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | |
| | | var headPath = imagePath; |
| | | #if __IOS__ |
| | | |
| | | |
| | | #else |
| | | //1.使用新名字,解决相同路径不刷新图片问题 |
| | | imageName = Guid.NewGuid().ToString() + ".png"; |
| | | //1.2删除原来本地头像 |
| | | System.IO.File.Delete(userHeadImageView.ImagePath); |
| | | Utlis.WriteLine("删除: " + userHeadImageView.ImagePath); |
| | | //1.3如果是安卓需要拷贝回来APP根目录 |
| | | FileUtils.FileCopyToRootPath(imagePath, imageName); |
| | | System.IO.File.Delete(imagePath); |
| | | headPath = imageName; |
| | | MainPage.Log("SelectPicture 最终路径: " + imageName); |
| | | #endif |
| | | |
| | | //清空原来图片 |
| | | userHeadImageView.ImagePath = "NULL"; |
| | | //生成图片 |
| | | UserInfo.Current.headImagePagePath = headPath; |
| | | userHeadImageView.ImagePath = headPath; |
| | | updataHeadImage(); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath); |
| | | new DAL.Server.HttpServerRequest().UpdataUserHeadImage(headPath); |
| | | }) |
| | | { IsBackground = true }.Start(); UserInfo.Current.SaveUserInfo(); |
| | | MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | { IsBackground = true }.Start(); |
| | | UserInfo.Current.SaveUserInfo(); |
| | | } |
| | | }, pid.ToString(), 1, 1); |
| | | pictureOptionView.RemoveFromParent(); |
| | | baseView.RemoveFromParent(); |
| | | }; |
| | | catch { } |
| | | |
| | | } |
| | | |
| | | /// <summary> |