From 8060dedbec31cc9dbc33adae91b94b8a977c7163 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 30 十一月 2020 21:22:55 +0800
Subject: [PATCH] 2020-11-30 1.增加极光推送。2.住宅相关接口增加签名校验。 3.增加消息中心页面。4.UI优化。5.裁剪选取图片优化。

---
 HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs |  110 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 80 insertions(+), 30 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
index 88e218e..0b08af1 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
@@ -118,23 +118,32 @@
             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 = Guid.NewGuid().ToString() + ".png";
+                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();
             };
@@ -147,29 +156,70 @@
             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() + ".png";
                 CropImage.SelectPicture((imagePath) =>
                 {
-                    if (imagePath != null)
-                    {
-                        UserInfo.Current.headImagePagePath = imagePath.ToString();
-                        userHeadImageView.ImagePath = imagePath.ToString();
-                        updataHeadImage();
+                    CropImageCallBack(imagePath, imageName);
+                }, imageName, 1, 1);
 
-                        new System.Threading.Thread(() =>
-                        {
-                            new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath);
-                        })
-                        { IsBackground = true }.Start(); UserInfo.Current.SaveUserInfo();
-                        MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath);
-                    }
-                }, pid.ToString(), 1, 1);
                 pictureOptionView.RemoveFromParent();
                 baseView.RemoveFromParent();
             };
         }
 
         /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="imagePath"></param>
+        /// <param name="imageName"></param>
+        void CropImageCallBack(string imagePath, string imageName)
+        {
+            if (string.IsNullOrEmpty(imagePath) == true)
+            {
+                return;
+            }
+            //鍒犻櫎鍘熸潵鏈湴澶村儚
+            System.IO.File.Delete(userHeadImageView.ImagePath);
+            Utlis.WriteLine("鍒犻櫎: " + userHeadImageView.ImagePath);
+
+            MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath);
+            //userHeadImageView.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath);
+            FileUtils.FileCopyToRootPath(imagePath, imageName);
+            System.IO.File.Delete(imagePath);
+            //鐢熸垚鍥剧墖
+            //Shared.IO.FileUtils.WriteFileByBytes(imageName, userHeadImageView.ImageBytes);
+            UserInfo.Current.headImagePagePath = imageName;
+            userHeadImageView.ImagePath = imageName;
+            updataHeadImage();
+
+            new System.Threading.Thread(() =>
+            {
+                new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imageName);
+            })
+            { IsBackground = true }.Start(); UserInfo.Current.SaveUserInfo();
+
+        }
+
+        /// <summary>
         /// 鍔犺浇淇敼鐢ㄦ埛鍚嶇О浜嬩欢
         /// </summary>
         void LoadEvent_EditUserName()

--
Gitblit v1.8.0