From f9181a9c8125136f597add7c30cb2ff508d54ba7 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 25 七月 2024 17:34:32 +0800 Subject: [PATCH] 2024年07月25日17:33:40 --- HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs | 304 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 293 insertions(+), 11 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs index 30a5652..3a6090b 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs @@ -1,7 +1,8 @@ 锘縰sing System; using Shared; using HDL_ON.UI.CSS; -using Xamarin.Essentials; +//using Xamarin.Essentials; +using HDL_ON.DAL.Server; namespace HDL_ON.UI { @@ -24,7 +25,268 @@ /// <summary> /// /// </summary> - public void LoadPage() + public void LoadPage() { + var loading = new Loading(); + this.AddChidren(loading); + loading.Start(""); + new System.Threading.Thread(() => { + try + { + var pack = new HttpServerRequest().GetUnregisterModel(); + if (pack.Code == StateCode.SUCCESS) + { + var data = Newtonsoft.Json.JsonConvert.DeserializeObject<UMode>(pack.Data.ToString()); + Application.RunOnMainThread(() => + { + if (data != null) + { + if (data.model == "APP") + { + InitView_PreRelease(); + } + else + { + InitView_Release(); + } + } + else + { + InitView_PreRelease(); + } + }); + } + else + { + Application.RunOnMainThread(() => + { + InitView_PreRelease(); + }); + } + } + catch + { + Application.RunOnMainThread(() => + { + InitView_PreRelease(); + }); + } + finally + { + Application.RunOnMainThread(() => + { + if (loading != null) + { + loading.Hide(); + loading.RemoveFromParent(); + loading = null; + } + }); + } + }) { IsBackground = true }.Start(); + } + + public void InitView_PreRelease() + { + var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.CancelAccount)); + topView.maginY = 10; + topView.LoadTopView(CSS_Color.MainBackgroundColor); + + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + + var textView = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(64 + 16), + Height = Application.GetRealHeight(90), + Width = Application.GetRealWidth(343), + Padding = new Padding(Application.GetRealWidth(16), Application.GetRealWidth(16), Application.GetRealWidth(16), Application.GetRealWidth(16)), + IsMoreLines = true, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.TopLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + Radius = (uint)Application.GetRealHeight(14), + BackgroundColor = 0x174484F4, + }; + + if (Language.CurrentLanguage == "Chinese") + { + textView.Text = "*娉ㄩ攢璐︽埛鏄笉鍙仮澶嶇殑鎿嶄綔锛屾敞閿�璐︽埛涔嬪悗锛屾偍App鎵�鏈夎处鎴锋暟鎹紙鍖呮嫭鏄电О銆佸ご鍍忋�佷簩缁寸爜鐓х墖绛夛級閮戒細琚垹闄わ紝涓旀棤娉曞啀鎵惧洖銆�"; + } + else + { + textView.Text = "*Account cancellation is an irreversible operation. After account cancellation, all account data (including nickname, avatar, QR code photo, etc.) of your app will be deleted and cannot be retrieved."; + } + bodyView.AddChidren(textView); + + + #region 璐﹀彿濉啓 + var accountView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(132 + 50), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealHeight(25), + }; + bodyView.AddChidren(accountView); + + var etAccount = new EditText() + { + X = Application.GetRealWidth(58), + Width = Application.GetRealWidth(343 - 68), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + PlaceholderTextColor = CSS_Color.PromptingColor1, + PlaceholderText = UserInfo.Current.AccountString,// Language.StringByID(StringId.PlsEntryPhoneNumber), + TextAlignment = TextAlignment.CenterLeft, + Enable = false + }; + accountView.AddChidren(etAccount); + + var btnAccountIcon = new Button() + { + X = Application.GetRealWidth(26), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(20), + Height = Application.GetMinRealAverage(20), + UnSelectedImagePath = "LoginIcon/AccountIcon.png", + }; + accountView.AddChidren(btnAccountIcon); + + #endregion + + #region 瀵嗙爜濉啓 + var passwordView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(211 + 40), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(50), + Radius = (uint)Application.GetRealHeight(25), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + bodyView.AddChidren(passwordView); + + + var btnPasswordIcon = new Button() + { + X = Application.GetRealWidth(26), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(20), + Height = Application.GetMinRealAverage(20), + UnSelectedImagePath = "LoginIcon/PasswordIcon.png", + }; + passwordView.AddChidren(btnPasswordIcon); + + var etPassword = new EditText() + { + X = Application.GetRealWidth(58), + Width = Application.GetRealWidth(343 - 68), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + PlaceholderTextColor = CSS_Color.PromptingColor1, + PlaceholderText = Language.StringByID(StringId.PlsEntryPassword), + SecureTextEntry = true, + TextAlignment = TextAlignment.CenterLeft, + }; + passwordView.AddChidren(etPassword); + + + #endregion + + + + var btnLogin = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(353), + Width = Application.GetRealWidth(220), + Height = Application.GetRealWidth(44), + Radius = (uint)Application.GetRealWidth(22), + SelectedBackgroundColor = CSS_Color.MainColor, + BackgroundColor = CSS_Color.PromptingColor1, + TextID = StringId.Cancellation, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.MainBackgroundColor, + TextAlignment = TextAlignment.Center, + }; + bodyView.AddChidren(btnLogin); + + etPassword.TextChangeEventHandler += (sender, e) => + { + if ( etPassword.Text.Trim().Length > 0) + { + btnLogin.IsSelected = true; + } + else + { + btnLogin.IsSelected = false; + } + }; + + btnLogin.MouseUpEventHandler = (sender,e) =>{ + if (btnLogin.IsSelected) + { + var tipMsg = "*鎮ㄥ綋鍓嶆鍦ㄦ敞閿�璐︽埛锛屾敞閿�瀹屾垚鍚庯紝鎮ㄥ湪On Pro App鐨勬墍鏈夋暟鎹潎浼氳鍒犻櫎锛岃璋ㄦ厧鎿嶄綔銆�"; + Action action = () => { + var loading = new Loading(); + this.AddChidren(loading); + loading.Start(""); + var pwd = etPassword.Text.Trim(); + new System.Threading.Thread(() => { + try + { + var pack = new HttpServerRequest().Unregister(pwd); + Application.RunOnMainThread(() => + { + if (pack.Code == StateCode.SUCCESS) + { + //Action okAction = () => + //{ + HDLCommon.Current.Logout(); + //}; + //new ConfirmDialog().ShowDialog(StringId.Tip, StringId.IfConfirmLogout, okAction); + } + else + { + var tip = new Tip() + { + Text = pack.message, + CloseTime = 3, + Direction = AMPopTipDirection.None + }; + tip.Show(bodyView); + } + }); + } + catch + { + } + finally + { + Application.RunOnMainThread(() => + { + if (loading != null) + { + loading.Hide(); + loading.RemoveFromParent(); + loading = null; + } + }); + } + }) + { IsBackground = true }.Start(); + + + }; + new PublicAssmebly().TipOptionMsg(StringId.CancelAccount, tipMsg, action, 20); + + } + }; + + } + public void InitView_Release() { new TopViewDiv(bodyView, Language.StringByID(StringId.CancelAccount)).LoadTopView(); @@ -96,14 +358,14 @@ phoneRow.AddChidren(btnImage); phoneRow.AddChidren(new Button() { X = Application.GetRealWidth(16), Y = Application.GetRealWidth(49), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); - EventHandler<MouseEventArgs> eventHandler = (sender, e) => - { - PhoneDialer.Open(Constant.SUPPORT_TELEPHONENUMBER); - }; + //EventHandler<MouseEventArgs> eventHandler = (sender, e) => + //{ + // PhoneDialer.Open(Constant.SUPPORT_TELEPHONENUMBER); + //}; - phoneRow.MouseUpEventHandler = eventHandler; - btnPhoneText.MouseUpEventHandler = eventHandler; - btnImage.MouseUpEventHandler = eventHandler; + //phoneRow.MouseUpEventHandler = eventHandler; + //btnPhoneText.MouseUpEventHandler = eventHandler; + //btnImage.MouseUpEventHandler = eventHandler; #endregion #region 鑱旂郴閭 @@ -192,10 +454,30 @@ /// <param name="text"></param> void CopyToClipboard(string text) { - Clipboard.SetTextAsync(text); - Utlis.ShowTip(text + "\n" + Language.StringByID(StringId.CopySuccess)); + //Clipboard.SetTextAsync(text); + //Utlis.ShowTip(text + "\n" + Language.StringByID(StringId.CopySuccess)); } + + bool isPublishingMode() + { + DAL.Server.HttpServerRequest http = new DAL.Server.HttpServerRequest(); + + return true; + } + + } + + class UMode + { + public string appCode; + public string version; + public string releaseSystem; + /// <summary> + /// APP 锛氱敤鎴峰湪app涓婅嚜鍔╂敞閿� + /// APPLY 锛� 鐢ㄦ埛鍙戦偖浠剁粰鍏徃鐢宠娉ㄩ攢 + /// </summary> + public string model; } } -- Gitblit v1.8.0