From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 10 七月 2020 10:52:13 +0800 Subject: [PATCH] 2020-07-10-01 --- ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs | 170 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 127 insertions(+), 43 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs index 3890e8f..0cbe83e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs @@ -24,9 +24,17 @@ /// </summary> private string passwordTip = string.Empty; /// <summary> - /// 鍒楄〃鐨勬甯冩帶浠� + /// 鑱旂郴浜虹殑鍒楄〃鎺т欢 /// </summary> - private FrameLayout frameTable = null; + private FrameListControl listPhoneView = null; + /// <summary> + /// 淇℃伅鎺т欢 + /// </summary> + private InformationEditorControl tableContr = null; + /// <summary> + /// 瀵嗙爜鎺т欢 + /// </summary> + private NormalViewControl btnPassword = null; /// <summary> /// 褰撳墠鐨勮仈绯讳汉鍒楄〃 /// </summary> @@ -45,6 +53,7 @@ { this.password = i_password; this.passwordTip = i_passwordTip; + this.ScrollEnabled = false; //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uCoercePassword)); @@ -61,9 +70,9 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); - this.frameTable = new FrameLayout(); - frameTable.Height = bodyFrameLayout.Height; - bodyFrameLayout.AddChidren(frameTable); + var listBackControl = new VerticalFrameControl(); + listBackControl.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listBackControl); var frameback = new FrameLayout(); frameback.Y = Application.GetRealHeight(179); @@ -71,7 +80,7 @@ frameback.Width = Application.GetRealWidth(717); frameback.Gravity = Gravity.CenterHorizontal; frameback.BackgroundImagePath = "Safeguard/SafeguardPasswordGround.png"; - bodyFrameLayout.AddChidren(frameback); + listBackControl.frameTable.AddChidren(frameback); //褰撳墠浣跨敤瀵嗙爜 var btnNowTip = new NormalViewControl(frameback.Width, Application.GetRealHeight(50), false); btnNowTip.Y = Application.GetRealHeight(81); @@ -80,7 +89,7 @@ btnNowTip.TextColor = UserCenterColor.Current.TextGrayColor3; btnNowTip.TextID = R.MyInternationalizationString.uNowUsePassword; frameback.AddChidren(btnNowTip); - var btnPassword = new NormalViewControl(frameback.Width, Application.GetRealHeight(90), false); + this.btnPassword = new NormalViewControl(frameback.Width, Application.GetRealHeight(90), false); btnPassword.TextAlignment = TextAlignment.Center; btnPassword.Y = Application.GetRealHeight(150); btnPassword.TextSize = 24; @@ -90,29 +99,27 @@ frameback.AddChidren(btnPassword); //鍒濆鍖栧垪琛ㄦ帶浠� - this.InitListViewControl(); + this.InitListViewControl(listBackControl); } /// <summary> /// 鍒濆鍖栧垪琛ㄦ帶浠� /// </summary> - private void InitListViewControl() + private void InitListViewControl(VerticalFrameControl listBackControl) { - this.frameTable.RemoveAll(); - //鍒濆鍖栨甯� - var tableContr = new InformationEditorControl(); - var listview = tableContr.InitControl(this.frameTable, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 711, 1025); + this.tableContr = new InformationEditorControl(); + var listView = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 1025); //澶囨敞淇℃伅 string caption = Language.StringByID(R.MyInternationalizationString.uNoteInformation); - var rowNote = new FrameCaptionInputControl(caption, passwordTip, listview.rowSpace / 2); + var rowNote = new FrameCaptionInputControl(caption, passwordTip, listView.rowSpace / 2); rowNote.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPlesaeInputNoteInformation); rowNote.txtInput.MaxByte = 90; - listview.AddChidren(rowNote); + listView.AddChidren(rowNote); rowNote.InitControl(); rowNote.AddBottomLine(); - rowNote.txtInput.FinishInputEvent += () => + rowNote.txtInput.FinishInputEvent += async () => { if (rowNote.Text == string.Empty) { @@ -122,13 +129,13 @@ if (passwordTip != rowNote.Text) { //淇敼瀵嗙爜澶囨敞 - this.EditorPassworTip(password, rowNote.Text); + await this.EditorPassworTip(password, rowNote.Text, true); } }; //淇敼瀵嗙爜 - var rowPsw = new FrameRowControl(listview.rowSpace / 2); - listview.AddChidren(rowPsw); + var rowPsw = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(rowPsw); rowPsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uChangedPassword), 300); rowPsw.AddRightArrow(); rowPsw.AddBottomLine(); @@ -136,7 +143,59 @@ { var form = new CoercePswAddNewForm(); form.AddForm(rowNote.Text); + form.PasswordChangedEvent += (newPassword) => + { + this.btnPassword.Text = newPassword; + this.password = newPassword; + }; }; + + //鍒濆鍖栬仈绯讳汉鎺т欢 + this.InitPhoneControl(listView); + + //閲嶅啓搴曞眰鐨勮繑鍥炴寜閿簨浠� + this.BackButtonClickEvent = async (sender) => + { + sender.CanClick = false; + if (rowNote.Text == string.Empty || passwordTip == rowNote.Text) + { + this.CloseForm(); + } + else + { + //淇敼瀵嗙爜澶囨敞 + var result = await this.EditorPassworTip(password, rowNote.Text, false); + sender.CanClick = true; + if (result == true) + { + this.CloseForm(); + } + } + }; + } + + #endregion + + #region 鈻� 鍒濆鍖栬仈绯讳汉鎺т欢___________________ + + /// <summary> + /// 鍒濆鍖栬仈绯讳汉鎺т欢 + /// </summary> + private void InitPhoneControl(FrameListControl listTableView) + { + //鑱旂郴浜虹殑鍒楄〃鎺т欢 + if (listPhoneView == null) + { + this.listPhoneView = new FrameListControl(); + listPhoneView.rowSpace = listTableView.rowSpace; + listPhoneView.Height = Application.GetRealHeight(200); + listTableView.AddChidren(listPhoneView); + listPhoneView.Y -= listTableView.rowSpace; + } + else + { + this.listPhoneView.RemoveAll(); + } HdlThreadLogic.Current.RunThread(async () => { @@ -157,9 +216,9 @@ { this.listPhoneData = new List<ZigBee.Device.Safeguard.PushTargetInfo>(); //鑱旂郴浜� - var rowContact = new FrameRowControl(listview.rowSpace / 2); + var rowContact = new FrameRowControl(this.listPhoneView.rowSpace / 2); rowContact.UseClickStatu = false; - listview.AddChidren(rowContact); + listPhoneView.AddChidren(rowContact); rowContact.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uContactPersion), 300); var btnAdd = rowContact.AddMostRightEmptyIcon(81, 81); btnAdd.UnSelectedImagePath = "Item/Add.png"; @@ -167,6 +226,11 @@ { var form = new CoercePswAddContactForm(); form.AddForm(listPhoneData); + form.AddPhoneEvent += () => + { + //閲嶆柊鍒锋柊 + this.InitPhoneControl(listTableView); + }; }; if (result.Actions.Count > 0) @@ -175,7 +239,7 @@ foreach (var data in listPhoneData) { //娣诲姞鑱旂郴浜鸿 - this.AddPhoneNumRowLayout(listview, data); + this.AddPhoneNumRowLayout(data); } } else @@ -183,8 +247,20 @@ //娌℃湁鑱旂郴浜虹殑璇�,娣诲姞涓簳绾� rowContact.AddBottomLine(); } + //璋冩暣妗屽竷澶у皬 + this.AdjustPhoneContrlTable(); }); }); + } + + /// <summary> + /// 璋冩暣妗屽竷澶у皬 + /// </summary> + private void AdjustPhoneContrlTable() + { + //璋冩暣妗屽竷 + listPhoneView.AdjustRealHeight(); + tableContr.FinishInitControl(false, true); } #endregion @@ -194,9 +270,8 @@ /// <summary> /// 娣诲姞鑱旂郴浜鸿 /// </summary> - /// <param name="listview"></param> /// <param name="data"></param> - private void AddPhoneNumRowLayout(VerticalListControl listview, ZigBee.Device.Safeguard.PushTargetInfo data) + private void AddPhoneNumRowLayout(ZigBee.Device.Safeguard.PushTargetInfo data) { var strArry = data.PushNumber.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries); if (strArry.Length != 2) @@ -220,8 +295,9 @@ } var rowContact = new RowLayoutControl(); + rowContact.MainKeys = strPhone; + this.listPhoneView.AddChidren(rowContact); rowContact.frameTable.UseClickStatu = false; - listview.AddChidren(rowContact); //鑱旂郴鏂瑰紡 rowContact.frameTable.AddLeftCaption(strPhone + " (" + data.PushNumberNote + ")", 800); rowContact.frameTable.AddBottomLine(); @@ -261,6 +337,22 @@ bool result = await HdlSafeguardLogic.Current.DeleteCoercePhoneNumber(areaCode, phone); if (result == true) { + bool canMove = false; + for (int i = 0; i < this.listPhoneView.ChildrenCount; i++) + { + var myRow = this.listPhoneView.GetChildren(i) as RowLayoutControl; + if (myRow != null && myRow.MainKeys == rowContact.MainKeys) + { + //寰幆鍒颁簡褰撳墠鎺т欢 + canMove = true; + continue; + } + if (canMove == true) + { + //瀹冧箣鍚庣殑鎺т欢鍏ㄩ儴寰�涓婄Щ鍔� + myRow.Y -= rowContact.Height; + } + } rowContact.RemoveFromParent(); //绉婚櫎缂撳瓨 @@ -272,6 +364,8 @@ listPhoneData.RemoveAt(i); } } + //璋冩暣妗屽竷澶у皬 + this.AdjustPhoneContrlTable(); } } @@ -284,31 +378,21 @@ /// </summary> /// <param name="i_password">鐢ㄦ埛瀵嗙爜</param> /// <param name="i_passwordTip">鐢ㄦ埛瀵嗙爜鎻愮ず</param> - private async void EditorPassworTip(string i_password, string i_passwordTip) + private async System.Threading.Tasks.Task<bool> EditorPassworTip(string i_password, string i_passwordTip, bool ShowMsg) { var result = await HdlSafeguardLogic.Current.AddPassWordTips(this.pswNo, i_password, i_passwordTip); if (result == true) { - //淇敼澶囨敞淇℃伅鎴愬姛! - string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationSuccess); - this.ShowMassage(ShowMsgType.Tip, msg); + if (ShowMsg == true) + { + //淇敼澶囨敞淇℃伅鎴愬姛! + string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationSuccess); + this.ShowMassage(ShowMsgType.Tip, msg); + } this.passwordTip = i_passwordTip; } - } - - #endregion - - #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________ - - /// <summary> - /// 鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠� - /// </summary> - public override int FormActionAgainEvent() - { - //鍒濆鍖栧垪琛ㄦ帶浠� - this.InitListViewControl(); - return 1; + return result; } #endregion -- Gitblit v1.8.0