From a715181089be0d31cd737a5367ffd02690b9d77f Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 12 十一月 2020 13:36:01 +0800 Subject: [PATCH] 20201112 --- HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs | 303 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 299 insertions(+), 4 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs index 90e2a7e..41b9bcd 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs @@ -1,4 +1,7 @@ 锘縰sing System; +using HDL_ON.Entity; +using Shared; + namespace HDL_ON.UI { public partial class PersonalDataPage @@ -8,14 +11,306 @@ /// </summary> void LoadEventList() { + LoadEvent_ChangeHeadImageView(); LoadEvent_Logout(); + LoadEvent_EditUserName(); + LoadEvent_SkipInterpretationSettings(); + LoadEvent_ChangeBindEmail(); + LoadEvent_ChangeBindPhone(); + LoadEvent_SkipModifyPassword(); } - void LoadEvent_Logout() + /// <summary> + /// 鍔犺浇閫夋嫨澶村儚閫夐」view + /// </summary> + void LoadEvent_ChangeHeadImageView() { - btnLogout.MouseUpEventHandler += (sender, e) => { - MainPage.GoLoginPage(MainPage.LoginUser.AccountString); + userHeadImageView.MouseUpEventHandler = (sender, e) => + { + LoadPictureOptionView(); }; } + + /// <summary> + /// 閫�鍑鸿处鍙风櫥褰曚簨浠� + /// </summary> + void LoadEvent_Logout() + { + btnLogout.MouseUpEventHandler += (sender, e) => + { + #region 淇濆瓨鏈湴鏁版嵁鑷虫枃浠跺す + string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); + new System.Threading.Thread(() => + { + try + { + var backuplist = FileUtils.ReadFiles(); + FileUtils.DeleteRegionFiles(oldRegionRootPath); + //绉诲姩鏂囦欢 + foreach (var fileName in backuplist) + { + System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); + if (fileInfo.Exists) + { + fileInfo.MoveTo(oldRegionRootPath + fileName); + MainPage.Log("move file : " + fileName); + } + } + } + catch (Exception ex) + { + MainPage.Log($"xxx:{ex.Message}"); + } + finally + { + FileUtils.DeleteAllFile(); + } + }).Start(); + #endregion + + MainPage.LoginUser.lastTime = DateTime.MinValue; + MainPage.LoginUser.SaveUserInfo(); + MainPage.GoLoginPage(MainPage.LoginUser); + DB_ResidenceData.residenceData.EixtAccount(); + }; + } + + /// <summary> + /// 鍔犺浇鑳屾櫙鍥鹃�夋嫨鍖哄煙浜嬩欢鍒楄〃 + /// </summary> + void LoadEvent_PictureOptionViewEventList(FrameLayout baseView) + { + pictureOptionView.MouseUpEventHandler = (sender, e) => + { + baseView.RemoveFromParent(); + }; + baseView.MouseUpEventHandler = (sender, e) => { + baseView.RemoveFromParent(); + }; + btnCancel.MouseUpEventHandler = (sender, e) => + { + baseView.RemoveFromParent(); + }; + + btnTakePicture.MouseUpEventHandler = (sender, e) => + { + btnTakePicture.IsSelected = true; + }; + btnTakePicture.MouseUpEventHandler = (sender, e) => + { + btnTakePicture.IsSelected = false; + var pid = Guid.NewGuid(); + CropImage.TakePicture((Action<string>)((imagePath) => + { + if (imagePath != null) + { + MainPage.LoginUser.headImagePagePath = imagePath.ToString(); + userHeadImageView.ImagePath = imagePath.ToString(); + updataHeadImage(); + new System.Threading.Thread(() => + { + new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath); + }) + { IsBackground = true }.Start(); + MainPage.LoginUser.SaveUserInfo(); + MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); + } + }), pid.ToString(), 1, 1); + pictureOptionView.RemoveFromParent(); + baseView.RemoveFromParent(); + }; + + btnAlbum.MouseUpEventHandler = (sender, e) => + { + btnAlbum.IsSelected = true; + }; + + btnAlbum.MouseUpEventHandler = (sender, e) => + { + btnAlbum.IsSelected = false; + var pid = Guid.NewGuid(); + CropImage.SelectPicture((imagePath) => + { + if (imagePath != null) + { + MainPage.LoginUser.headImagePagePath = imagePath.ToString(); + userHeadImageView.ImagePath = imagePath.ToString(); + updataHeadImage(); + + new System.Threading.Thread(() => + { + new DAL.Server.HttpServerRequest().UpdataUserHeadImage(imagePath); + }) + { IsBackground = true }.Start(); MainPage.LoginUser.SaveUserInfo(); + MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath); + } + }, pid.ToString(), 1, 1); + pictureOptionView.RemoveFromParent(); + baseView.RemoveFromParent(); + }; + } + + /// <summary> + /// 鍔犺浇淇敼鐢ㄦ埛鍚嶇О浜嬩欢 + /// </summary> + void LoadEvent_EditUserName() + { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + Action<string> callBack = (str) => + { + if (string.IsNullOrEmpty(str)) + { + new Tip() + { + CloseTime = 1, + Text = Language.StringByID(StringId.UesrNameCannotBeEmpty), + Direction = AMPopTipDirection.None, + }.Show(bodyView); + return; + } + if(str == MainPage.LoginUser.userName) + { + return; + } + var waitPage = new Loading(); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + new System.Threading.Thread(() => + { + try + { + var responsePack = new DAL.Server.HttpServerRequest().EditUserName(str); + if (responsePack.StateCode.ToUpper() == "SUCCESS") + { + MainPage.LoginUser.userName = str; + MainPage.LoginUser.SaveUserInfo(); + Application.RunOnMainThread(() => + { + btnUserName.Text = str; + updataUserName(); + }); + } + else + { + var tipStr = "Server erorr"; + switch (responsePack.StateCode) + { + case "NoLogin": + tipStr = Language.StringByID(StringId.InvalidLoginCertificate); + break; + case "AccountNoExists": + tipStr = ""; + break; + } + Application.RunOnMainThread(() => + { + //鎻愮ず鍘熷洜 + var tip = new Tip() + { + Text = tipStr, + CloseTime = 1, + Direction = AMPopTipDirection.None + }; + tip.Show(bodyView); + }); + } + } + catch (Exception ex) + { + MainPage.Log($"update user name error : {ex.Message}"); + } + finally + { + Application.RunOnMainThread(() => + { + waitPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); + }; + new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, MainPage.LoginUser.userName, callBack, StringId.UesrNameCannotBeEmpty, 0, new System.Collections.Generic.List<string>()); + }; + btnUserName.MouseUpEventHandler = eventHandler; + btnEditUserNameIcon.MouseUpEventHandler = eventHandler; + } + + #region 淇敼缁戝畾閭 + /// <summary> + /// 淇敼缁戝畾閭 + /// </summary> + void LoadEvent_ChangeBindEmail() + { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => { + Action<string> action = (email) => + { + btnUserEmailInfo.Text = email; + }; + + var aep = new AccountBindInfoPage(); + MainPage.BasePageView.AddChidren(aep); + aep.LoadPage(action,1,StringId.EmailAddress); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + btnUserEmailInfo.MouseUpEventHandler = eventHandler; + btnUserEmailRight.MouseUpEventHandler = eventHandler; + userEmailInfoView.MouseUpEventHandler = eventHandler; + } + /// <summary> + /// 淇敼缁戝畾鎵嬫満 + /// </summary> + void LoadEvent_ChangeBindPhone() + { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => { + Action<string> action = (phone) => + { + btnUserPhoneInfo.Text = phone; + }; + + var aep = new AccountBindInfoPage(); + MainPage.BasePageView.AddChidren(aep); + aep.LoadPage(action, 2, StringId.PhoneInfo); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + btnUserPhoneInfo.MouseUpEventHandler = eventHandler; + btnUserPhoneRight.MouseUpEventHandler = eventHandler; + userPhoneInfoView.MouseUpEventHandler = eventHandler; + } + #endregion + + #region 瑙i攣璁剧疆鍖哄煙 + void LoadEvent_SkipInterpretationSettings() + { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + var page = new AppUnlockSettingsPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + btnInterpretationSettingsRight.MouseUpEventHandler = eventHandler; + btnInterpretationSettingsTitle.MouseUpEventHandler = eventHandler; + btnInterpretationSettingsTip.MouseUpEventHandler = eventHandler; + } + + #endregion + + /// <summary> + /// 璺宠浆淇敼瀵嗙爜鐣岄潰 + /// </summary> + void LoadEvent_SkipModifyPassword() + { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => { + var page = new ResetPasswordOptionPage(); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + btnResetPasswordRight.MouseUpEventHandler = eventHandler; + btnResetPasswordText.MouseUpEventHandler = eventHandler; + resetPasswordView.MouseUpEventHandler = eventHandler; + } + } -} +} \ No newline at end of file -- Gitblit v1.8.0