From ffdeae1a43e1539f9533f93d64089994db6c742b Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 09 六月 2021 17:23:01 +0800
Subject: [PATCH] Merge branch 'tzy2' into wxr6

---
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs |  295 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 295 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs
new file mode 100644
index 0000000..20484cb
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs
@@ -0,0 +1,295 @@
+锘縰sing System;
+using Shared;
+using HDL_ON.UI.CSS;
+using HDL_ON.Stan;
+using System.Collections.Generic;
+
+namespace HDL_ON.UI
+{
+    /// <summary>
+    /// 鎵ц杩囨埛鎿嶄綔鐨勭晫闈�
+    /// </summary>
+    public class TransferingResidenceForm : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 鎴愬憳淇℃伅
+        /// </summary>
+        private AccountInfoResult accountResult = null;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        /// <param name="i_accountResult">璐﹀彿淇℃伅</param>
+        public void ShowForm(AccountInfoResult i_accountResult)
+        {
+            this.ScrollLeftEnabled = false;
+
+            this.accountResult = i_accountResult;
+
+            //杩囨埛
+            base.SetTitleText(Language.StringByID(StringId.Transfer));
+
+
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            this.InitMiddleFrame();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// </summary>
+        private void InitMiddleFrame()
+        {
+            //娓呯┖bodyFrame
+            this.ClearBodyFrame();
+
+            //涓讳汉鐨勫浘鏍�
+            var btnAdminIcon = new ImageView();
+            btnAdminIcon.Y = Application.GetRealHeight(112);
+            btnAdminIcon.X = Application.GetRealWidth(48);
+            btnAdminIcon.Height = this.GetPictrueRealSize(70);
+            btnAdminIcon.Width = this.GetPictrueRealSize(70);
+            btnAdminIcon.Radius = (uint)this.GetPictrueRealSize(70) / 2;
+            btnAdminIcon.ImagePath = UserInfo.Current.headImagePagePath;
+            bodyFrameLayout.AddChidren(btnAdminIcon);
+            //涓讳汉鍚嶅瓧  (浠ヤ腑闂翠负鍩哄噯,宸﹀彸闂磋窛16)
+            var btnAdminName = new NormalViewControl((btnAdminIcon.Right + btnAdminIcon.X) - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(48), false);
+            btnAdminName.X = HdlControlResourse.XXLeft;
+            btnAdminName.Y = btnAdminIcon.Bottom + Application.GetRealHeight(10);
+            btnAdminName.IsBold = true;
+            btnAdminName.IsMoreLines = true;
+            btnAdminName.TextAlignment = TextAlignment.TopCenter;
+            btnAdminName.TextSize = CSS_FontSize.SubheadingFontSize;
+            btnAdminName.Text = string.IsNullOrEmpty(UserInfo.Current.userName) == true ? UserInfo.Current.AccountString : UserInfo.Current.userName;
+            bodyFrameLayout.AddChidren(btnAdminName);
+
+            //澶村儚
+            var imageByte = ImageUtlis.Current.ReadFile(this.accountResult.MemberHeadIcon);
+            var btnUserIcon = new ImageView();
+            btnUserIcon.Y = btnAdminIcon.Y;
+            btnUserIcon.X = bodyFrameLayout.Width - Application.GetRealWidth(48) - this.GetPictrueRealSize(70);
+            btnUserIcon.Height = this.GetPictrueRealSize(70);
+            btnUserIcon.Width = this.GetPictrueRealSize(70);
+            btnUserIcon.Radius = (uint)this.GetPictrueRealSize(70) / 2;
+            if (imageByte != null && imageByte.Length > 0)
+            {
+                btnUserIcon.ImageBytes = imageByte;
+            }
+            else
+            {
+                btnUserIcon.ImagePath = "LoginIcon/2.png";
+            }
+            bodyFrameLayout.AddChidren(btnUserIcon);
+
+            //鏄电О  (浠ヤ腑闂翠负鍩哄噯,宸﹀彸闂磋窛50)
+            var btnName = new NormalViewControl(btnAdminName.Width, btnAdminName.Height, false);
+            btnName.X = bodyFrameLayout.Width - btnAdminName.X - btnAdminName.Width;
+            btnName.Y = btnAdminName.Y;
+            btnName.IsBold = true;
+            btnName.IsMoreLines = true;
+            btnName.TextAlignment = TextAlignment.TopCenter;
+            btnName.TextSize = CSS_FontSize.SubheadingFontSize;
+            btnName.Text = accountResult.MemberName;
+            bodyFrameLayout.AddChidren(btnName);
+
+            //寮�鍚繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉绾跨▼
+            this.StartConcetionAnimeteThread(btnAdminIcon.Right + Application.GetRealWidth(16));
+
+            //缁堟
+            var btnCancel = new BottomClickButton();
+            btnCancel.Y = Application.GetRealHeight(519);
+            btnCancel.TextID = StringId.Terminate;
+            bodyFrameLayout.AddChidren(btnCancel);
+            btnCancel.ButtonClickEvent += (sender, e) =>
+            {
+                this.CloseForm();
+            };
+
+            //鍒濆鍖栨秷鎭帶浠�
+            this.InitMsgControl();
+        }
+
+        #endregion
+
+        #region 鈻� 鍋囨兂鍔ㄧ敾___________________________
+
+        /// <summary>
+        /// 寮�鍚繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉绾跨▼
+        /// </summary>
+        private void StartConcetionAnimeteThread(int XX)
+        {
+            //鐢熸垚鐐瑰彿鍥炬牱
+            int pointXX = XX;
+            int pointWidth = Application.GetRealWidth(4);
+            int pointSpace = Application.GetRealWidth(9);
+            for (int i = 0; i < 9; i++)
+            {
+                var btnPoint = new NormalViewControl(pointWidth, pointWidth, false);
+                btnPoint.Radius = (uint)pointWidth / 2;
+                btnPoint.BackgroundColor = CSS_Color.PromptingColor1;
+                btnPoint.Y = Application.GetRealHeight(144);
+                btnPoint.X = pointXX;
+                bodyFrameLayout.AddChidren(btnPoint);
+                pointXX = btnPoint.Right + pointSpace;
+            }
+
+            var listPoint = new List<int>();
+            //璺冲姩鐨勯棿璺�
+            int jumpSpace = pointWidth + pointSpace;
+            for (int i = 0; i < 9; i++)
+            {
+                //X杞�+Index*(鍥炬爣澶у皬+闂磋窛)
+                listPoint.Add(XX + i * jumpSpace);
+            }
+
+            var btnRound = new IconViewControl(8);
+            btnRound.Radius = (uint)btnRound.IconSize / 2;
+            btnRound.BackgroundColor = CSS_Color.MainColor;
+            btnRound.X = listPoint[0] - (btnRound.IconSize - pointWidth) / 2;
+            btnRound.Y = Application.GetRealHeight(142);
+            bodyFrameLayout.AddChidren(btnRound);
+
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                int index = 1;
+                while (this.Parent != null)
+                {
+                    System.Threading.Thread.Sleep(500);
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        if (btnRound != null)
+                        {
+                            btnRound.X = listPoint[index];
+                            index++;
+                            if (index == listPoint.Count)
+                            {
+                                index = 0;
+                            }
+                        }
+                    });
+                }
+            });
+        }
+
+        #endregion
+
+        #region 鈻� 鎵ц杩囨埛___________________________
+
+        /// <summary>
+        /// 鎵ц杩囨埛
+        /// </summary>
+        private void DoTransferResidence()
+        {
+            this.ShowProgressBar();
+            System.Threading.Thread.Sleep(1500);
+            //杩囨埛
+            bool success = new DAL.Server.HttpServerRequest().TransferResidence(this.accountResult.Account);
+
+            this.CloseProgressBar();
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                var form = new TransferResidenceResultPage();
+                form.AddForm(this.accountResult, success);
+                form.FinishEvent += () =>
+                {
+                    if (success == false)
+                    {
+                        //閲嶈瘯
+                        HdlThreadLogic.Current.RunThread(() =>
+                        {
+                            //鎵ц杩囨埛
+                            this.DoTransferResidence();
+                        });
+                    }
+                    else
+                    {
+                        for (int i = 0; i < UserInfo.Current.regionList.Count; i++)
+                        {
+                            //绉婚櫎褰撳墠浣忓畢Id
+                            if (UserInfo.Current.regionList[i].id == Entity.DB_ResidenceData.Instance.CurrentRegion.id)
+                            {
+                                UserInfo.Current.regionList.RemoveAt(i);
+                                UserInfo.Current.SaveUserInfo();
+                                break;
+                            }
+                        }
+                        //鍏抽棴鎵�鏈夌晫闈�
+                        HdlFormLogic.Current.CloseAllOpenForm();
+
+                        if (UserInfo.Current.regionList.Count == 0)
+                        {
+                            //娌℃湁浣忓畢浜�,杩斿洖鐧婚檰鐣岄潰
+                            HDLCommon.Current.Logout();
+                        }
+                        else
+                        {
+                            Entity.DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
+                            Entity.DB_ResidenceData.Instance.SaveResidenceData();
+                            //鍒锋柊浣忓畢鏁版嵁
+                            Common.ApiUtlis.Ins.DownloadData();
+
+                            //鑾峰彇涓婚〉鐨勯偅涓鍣�
+                            var userPage = MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1) as UserPage;
+                            if (userPage != null)
+                            {
+                                //鍒锋柊涓汉涓績鐣岄潰
+                                MainPage.CurPageIndex = 1;
+                                userPage.ChoosePersonalCenter();
+                            }
+                        }
+                    }
+                };
+            });
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 鍒濆鍖栨秷鎭帶浠�
+        /// </summary>
+        private void InitMsgControl()
+        {
+            string msg = Language.StringByID(StringId.IsTransferingPleaseWaitting);
+
+            //姝e湪杩囨埛缁欑敤鎴�,璇风◢鍚�...
+            var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(20), false);
+            btnMsg.Y = Application.GetRealHeight(288);
+            btnMsg.TextAlignment = TextAlignment.Center;
+            btnMsg.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
+            btnMsg.Text = msg;
+            bodyFrameLayout.AddChidren(btnMsg);
+
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                int timeOut = 15;
+                while (timeOut >= 0 && this.Parent != null)
+                {
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        btnMsg.Text = msg + timeOut + "s";
+                        if (timeOut == 0)
+                        {
+                            btnMsg.Text = msg;
+                        }
+                    }, ShowErrorMode.NO);
+                    System.Threading.Thread.Sleep(1000);
+                    timeOut--;
+                }
+                if (timeOut <= 0)
+                {
+                    //鎵ц杩囨埛鎿嶄綔
+                    this.DoTransferResidence();
+                }
+            });
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0