From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 14 十二月 2020 09:59:01 +0800 Subject: [PATCH] 请合并代码,完成晾衣架最终功能。 --- ZigbeeApp/Shared/Phone/UserCenter/Transfer/TransferingResidenceForm.cs | 319 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 319 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Transfer/TransferingResidenceForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Transfer/TransferingResidenceForm.cs new file mode 100755 index 0000000..98816ce --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Transfer/TransferingResidenceForm.cs @@ -0,0 +1,319 @@ +锘縰sing Shared.Common; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.Transfer +{ + /// <summary> + /// 鎵ц杩囨埛鎿嶄綔鐨勭晫闈� + /// </summary> + public class TransferingResidenceForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 1:绉讳氦缁欑敤鎴� 2:鎺堟潈缁欒皟璇曚汉鍛� + /// </summary> + private int TransferDiv = 0; + /// <summary> + /// 鎴愬憳淇℃伅 + /// </summary> + private AccountInfoResult memberResult = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_memberResult">璐﹀彿淇℃伅</param> + /// <param name="i_TransferDiv">1:绉讳氦缁欑敤鎴� 2:鎺堟潈缁欒皟璇曚汉鍛�</param> + public void ShowForm(AccountInfoResult i_memberResult, int i_TransferDiv) + { + this.ScrollEnabled = false; + + this.TransferDiv = i_TransferDiv; + this.memberResult = i_memberResult; + + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(i_TransferDiv == 1 + ? Language.StringByID(R.MyInternationalizationString.HandoverToUser).Replace("{0}", string.Empty) + : Language.StringByID(R.MyInternationalizationString.AuthorizedToCommissioningPersonnel).Replace("{0}", string.Empty)); + + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //浣忓畢鐨勫浘鏍� + var btnIcon1 = new PicViewControl(268, 268); + btnIcon1.Y = Application.GetRealHeight(366); + btnIcon1.X = Application.GetRealWidth(139); + btnIcon1.UnSelectedImagePath = "Item/TransferOfResidenceIcon.png"; + bodyFrameLayout.AddChidren(btnIcon1); + //浣忓畢鍚嶅瓧 (浠ヤ腑闂翠负鍩哄噯,宸﹀彸闂磋窛50) + var btnHouseName = new NormalViewControl(bodyFrameLayout.Width / 2 - Application.GetRealWidth(100), Application.GetRealHeight(110), false); + btnHouseName.X = Application.GetRealWidth(50); + btnHouseName.Y = btnIcon1.Bottom + Application.GetRealHeight(23); + btnHouseName.IsBold = true; + btnHouseName.IsMoreLines = true; + btnHouseName.TextAlignment = TextAlignment.Center; + btnHouseName.TextSize = 16; + btnHouseName.Text = Config.Instance.Home.Name; + bodyFrameLayout.AddChidren(btnHouseName); + + //澶村儚 + var btnUserIcon = new ImageView(); + btnUserIcon.Height = this.GetPictrueRealSize(268); + btnUserIcon.Width = this.GetPictrueRealSize(268); + btnUserIcon.Radius = (uint)this.GetPictrueRealSize(268) / 2; + if (memberResult.HeadImage != null) + { + btnUserIcon.ImageBytes = memberResult.HeadImage; + } + else + { + btnUserIcon.ImagePath = "Center/Admin.png"; + } + btnUserIcon.Y = btnIcon1.Y; + btnUserIcon.X = bodyFrameLayout.Width - Application.GetRealWidth(139) - this.GetPictrueRealSize(268); + bodyFrameLayout.AddChidren(btnUserIcon); + + //鏄电О (浠ヤ腑闂翠负鍩哄噯,宸﹀彸闂磋窛50) + var btnName = new NormalViewControl(btnHouseName.Width, btnHouseName.Height, false); + btnName.X = btnHouseName.Right + Application.GetRealWidth(100); + btnName.Y = btnHouseName.Y; + btnName.IsBold = true; + btnName.IsMoreLines = true; + btnName.TextAlignment = TextAlignment.Center; + btnName.TextSize = 16; + //濡傛灉瀹冩湰韬氨娌″悕瀛楃殑璇濓紝鎶婁粬鐨処D浣滀负鏄电О + btnName.Text = string.IsNullOrEmpty(memberResult.UserName) == true ? memberResult.Account : memberResult.UserName; + bodyFrameLayout.AddChidren(btnName); + + //寮�鍚繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉绾跨▼ + this.StartConcetionAnimeteThread(btnIcon1.Right + Application.GetRealWidth(49)); + + //缁堟 + var btnCancel = new BottomClickButton(); + btnCancel.TextID = R.MyInternationalizationString.uTermination; + bodyFrameLayout.AddChidren(btnCancel); + btnCancel.ButtonClickEvent += (sender, e) => + { + this.CloseForm(); + }; + + //鍒濆鍖栨秷鎭帶浠� + this.InitMsgControl(btnCancel); + + } + + #endregion + + #region 鈻� 鍋囨兂鍔ㄧ敾___________________________ + + /// <summary> + /// 寮�鍚繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉绾跨▼ + /// </summary> + private void StartConcetionAnimeteThread(int XX) + { + //鐢熸垚鐐瑰彿鍥炬牱 + int pointXX = XX; + for (int i = 0; i < 7; i++) + { + var btnPoint = new NormalViewControl(14, 8, true); + btnPoint.Radius = (uint)Application.GetRealHeight(8) / 2; + btnPoint.BackgroundColor = 0xffd5d5d5; + btnPoint.Y = Application.GetRealHeight(498); + btnPoint.X = pointXX; + bodyFrameLayout.AddChidren(btnPoint); + pointXX = btnPoint.Right + Application.GetRealWidth(14); + } + + int iconSize = this.GetPictrueRealSize(24); + + var listPoint = new List<int>(); + //璺冲姩鐨勯棿璺� + int intSpace = Application.GetRealWidth(14 + 14); + for (int i = 0; i < 7; i++) + { + //X杞�+Index*(鍥炬爣澶у皬+闂磋窛) + listPoint.Add(XX + i * intSpace); + } + + var btnRound = new PicViewControl(iconSize, iconSize, false); + btnRound.Radius = (uint)iconSize / 2; + btnRound.BackgroundColor = UserCenterColor.Current.ConcetionRoundColor; + btnRound.X = listPoint[0]; + btnRound.Y = Application.GetRealHeight(490); + 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); + + var pra2 = new + { + RequestVersion = CommonPage.RequestVersion, + RequestSource = 0, + LoginAccessToken = Config.Instance.Token, + HomeId = Config.Instance.Home.Id, + TargetAccount = this.memberResult.Account + }; + var result = UserCenterLogic.GetResultCodeByRequestHttps("App/SellHome", false, pra2, new List<string> { "NotCheck" }); + bool success = result.ToLower() == "success"; + + this.CloseProgressBar(); + HdlThreadLogic.Current.RunMain(() => + { + var form = new TransferResidenceResultForm(); + form.AddForm(this.memberResult, success); + form.FinishEvent += () => + { + if (success == false) + { + //閲嶈瘯 + HdlThreadLogic.Current.RunThread(() => + { + //鎵ц杩囨埛 + this.DoTransferResidence(); + }); + } + else + { + //鎴愬姛杩囨埛 鍒欏垏鎹綇瀹� + var listLocalHouse = HdlResidenceLogic.Current.GetAllLocalResidenceListByDirectory(); + if (listLocalHouse.Count == 1) + { + //濡傛灉鍙湁涓�涓綇瀹�,鍒欒繃鎴蜂箣鍚�,鐩存帴閫�鍒扮櫥闄嗙晫闈� + UserCenterLogic.ReLoginAgain(Config.Instance.Account); + return; + } + else + { + HdlThreadLogic.Current.RunThread(() => + { + this.ShowProgressBar(); + //鍙栦竴涓綇瀹卛d + string houseId = string.Empty; + foreach (var myHouse in listLocalHouse) + { + houseId = myHouse.Id; + if (houseId != Config.Instance.Home.Id) + { + //闅忎究鍙栦竴涓拰褰撳墠浣忓畢涓嶇浉绛夌殑ID + break; + } + } + //褰撳墠浣忓畢ID + string nowHouseId = Config.Instance.Home.Id; + //鍒囨崲浣忓畢 + bool result2 = HdlResidenceLogic.Current.SwitchResidence(houseId); + //鍒犳帀杩欎釜鏂囦欢澶� + HdlResidenceLogic.Current.DeleteHouseMemmory(nowHouseId); + + if (result2 == true) + { + HdlThreadLogic.Current.RunMain(() => + { + //鍏抽棴鍏ㄩ儴鐨勭晫闈�.鐩村埌浣忓畢鍒楄〃鐣岄潰 + UserCenterLogic.CloseAllOpenForm("ResidenceListMainForm"); + }); + } + this.CloseProgressBar(); + }); + + } + } + }; + }); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鍒濆鍖栨秷鎭帶浠� + /// </summary> + private void InitMsgControl(BottomClickButton btnCancel) + { + string msg = this.TransferDiv == 1 + ? Language.StringByID(R.MyInternationalizationString.uHandoverToUserPleaseWaitting) + : Language.StringByID(R.MyInternationalizationString.uAuthorizingToDebuggingPersonnelPleaseWaitting); + + //姝e湪绉讳氦缁欑敤鎴�,璇风◢鍚�... 姝e湪鎺堟潈缁欒皟璇曚汉鍛�,璇风◢鍚�... + var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + btnMsg.Y = Application.GetRealHeight(916); + btnMsg.TextAlignment = TextAlignment.Center; + btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3; + 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