From 38ab16c66df6fc523f2c385fd583a2f2e86a781c Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 29 四月 2020 17:58:45 +0800 Subject: [PATCH] 2020-4-29-1 --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs | 394 +++++++++++++++++++++++++++++++------------------------ 1 files changed, 222 insertions(+), 172 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs old mode 100755 new mode 100644 index 8d6df41..30d7a5f --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs @@ -1,8 +1,8 @@ 锘縰sing System; using System.Text; -using System.Text.RegularExpressions; -using Shared.Common; - +using System.Text.RegularExpressions; +using Shared.Common; + namespace Shared.Phone.UserCenter.DoorLock { /// <summary> @@ -18,11 +18,11 @@ /// <summary> /// 鐐瑰嚮鍙栨秷鐨勫洖璋冧簨浠� /// </summary> - public Action CancelClickEvent = null; + public Action CancelClickEvent = null; /// <summary> /// 鐐瑰嚮鑷姩鍖栫殑鍥炶皟浜嬩欢 /// </summary> - public Action LogicClickEvent = null; + public Action LogicClickEvent = null; /// <summary> /// 鐐瑰嚮纭鐨勫洖璋冧簨浠� /// </summary> @@ -50,16 +50,16 @@ /// <summary> /// 纭鎸夐挳鐨勬枃鏈� /// </summary> - private string buttonOkText = null; - /// <summary> - /// 澶辨晥鏃堕棿缂栬緫 - /// </summary> - private EditText editInvalidTime = null; - + private string buttonOkText = null; + /// <summary> + /// 澶辨晥鏃堕棿缂栬緫 + /// </summary> + private EditText editInvalidTime = null; + #endregion - + #region 鈻� 鍒濆鍖朹____________________________ - + /// <summary> /// 鏄剧ず涓�涓渶瑕佺‘璁ょ殑淇℃伅妗� /// </summary> @@ -71,7 +71,7 @@ //纭鎸夐挳鏂囨湰 this.buttonOkText = buttonText == null ? Language.StringByID(R.MyInternationalizationString.OkMsg) : buttonText; this.msgType = i_msgType; - this.msgText = i_msg; + this.msgText = i_msg; } #endregion @@ -84,8 +84,8 @@ public void Show() { try - { - //鍒濆鍖栨帶浠� + { + //鍒濆鍖栨帶浠� this.InitMsgControl(); } catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex); } @@ -112,6 +112,11 @@ ((ViewGroup)nowForm).AddChidren(MsgControlFrameLayout); MsgControlFrameLayout.MouseDownEventHandler += (sender, e) => { + if (msgType == DoorLockMsgType.InValid) + { + return; + } + //绉婚櫎鐣岄潰 MsgControlFrameLayout.RemoveFromParent(); //鍥炶皟鍑芥暟 @@ -121,24 +126,24 @@ //鐧借壊鑳屾櫙妗� var frameBack = new FrameLayout(); - frameBack.BackgroundColor = UserCenterColor.Current.White; + frameBack.BackgroundColor = UserCenterColor.Current.White; frameBack.Gravity = Gravity.CenterHorizontal; frameBack.Radius = (uint)Application.GetRealHeight(17); - if (msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) - { - frameBack.Height = Application.GetRealHeight(409 + 127); - frameBack.Width = Application.GetRealWidth(850); - frameBack.Y = Application.GetRealHeight(648); - } - else - { - frameBack.Height = Application.GetRealHeight(478); - frameBack.Width = Application.GetRealWidth(792); - frameBack.Y = Application.GetRealHeight(706); + if (msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) + { + frameBack.Height = Application.GetRealHeight(409 + 127); + frameBack.Width = Application.GetRealWidth(850); + frameBack.Y = Application.GetRealHeight(648); } - MsgControlFrameLayout.AddChidren(frameBack); - - //鏍囬 + else + { + frameBack.Height = Application.GetRealHeight(478); + frameBack.Width = Application.GetRealWidth(792); + frameBack.Y = Application.GetRealHeight(706); + } + MsgControlFrameLayout.AddChidren(frameBack); + + //鏍囬 var btnTitle = new NormalViewControl(frameBack.Width, Application.GetRealHeight(65), false); btnTitle.Y = Application.GetRealHeight(68); btnTitle.TextColor = 0xff333443; @@ -148,7 +153,7 @@ if (msgType == DoorLockMsgType.Confirm || msgType == DoorLockMsgType.DoorLockLogic || msgType == DoorLockMsgType.NomallyOpenMode || msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) { btnTitle.TextID = R.MyInternationalizationString.NormalTip; - } + } else if (msgType == DoorLockMsgType.InValid) { btnTitle.TextID = R.MyInternationalizationString.DoorLockInValidSetting; @@ -160,113 +165,118 @@ if (msgType == DoorLockMsgType.InValid) { - InitInValidTimeDialog(frameBack); - } - else if (msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) - { - CancelNormallyOpenModeWithLogicDialog(frameBack); - } - else - { - //娑堟伅 - var btnMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(55 * 2), Application.GetRealHeight(180), false); - btnMsg.Y = Application.GetRealHeight(141); - btnMsg.IsMoreLines = true; - btnMsg.TextAlignment = TextAlignment.Center; - btnMsg.TextColor = UserCenterColor.Current.TextGrayColor1; - btnMsg.Gravity = Gravity.CenterHorizontal; - frameBack.AddChidren(btnMsg); - btnMsg.Text = msgText; + InitInValidTimeDialog(frameBack); + } + else if (msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) + { + CancelNormallyOpenModeWithLogicDialog(frameBack); + } + else + { + //娑堟伅 + var btnMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(55 * 2), Application.GetRealHeight(180), false); + btnMsg.Y = Application.GetRealHeight(141); + btnMsg.IsMoreLines = true; + btnMsg.TextAlignment = TextAlignment.Center; + btnMsg.TextColor = UserCenterColor.Current.TextGrayColor1; + btnMsg.Gravity = Gravity.CenterHorizontal; + frameBack.AddChidren(btnMsg); + btnMsg.Text = msgText; } - if (msgType == DoorLockMsgType.Confirm || msgType == DoorLockMsgType.InValid || msgType == DoorLockMsgType.NomallyOpenMode || msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) + if (msgType == DoorLockMsgType.Confirm || msgType == DoorLockMsgType.NomallyOpenMode || msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) { //鍒濆鍖栫‘璁ょ被鍨嬬殑搴曢儴鎸夐挳 this.InitBottomConfirmButton(MsgControlFrameLayout, frameBack); - } + } + else if (msgType == DoorLockMsgType.InValid) + { + //澶辨晥璁剧疆鐨勫簳閮ㄦ寜閽� + this.InitBottomInvalidTimeButton(MsgControlFrameLayout, frameBack); + } else if (msgType == DoorLockMsgType.DoorLockLogic) { //澶辨晥璁剧疆鐨勫簳閮ㄦ寜閽� this.InitBottomLogicButton(MsgControlFrameLayout, frameBack); } - } - + } + /// <summary> /// 鍙栨秷甯稿紑妯″紡甯︽湁鑷姩鍖栫殑寮圭獥鏄剧ず /// </summary> /// <param name="frameMain"></param> /// <param name="frameBack"></param> private void CancelNormallyOpenModeWithLogicDialog(FrameLayout frameBack) - { - //娑堟伅 - var btnMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(55 * 2), Application.GetRealHeight(63), false); - btnMsg.Y = Application.GetRealHeight(173); - btnMsg.IsMoreLines = true; - btnMsg.TextAlignment = TextAlignment.Center; - btnMsg.TextColor = UserCenterColor.Current.TextGrayColor1; - btnMsg.Gravity = Gravity.CenterHorizontal; - frameBack.AddChidren(btnMsg); - btnMsg.Text = msgText; - - var alarmMsg = Language.StringByID(R.MyInternationalizationString.XingTip);//.Replace("{0}", "\r\n"); - var btnAlarmMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(55 * 2), Application.GetRealHeight(104), false); - btnAlarmMsg.Y = Application.GetRealHeight(259); - btnAlarmMsg.IsMoreLines = true; - btnAlarmMsg.TextAlignment = TextAlignment.Center; - btnAlarmMsg.TextColor = ZigbeeColor.Current.XMAlarmText; - btnAlarmMsg.Gravity = Gravity.CenterHorizontal; - frameBack.AddChidren(btnAlarmMsg); - btnAlarmMsg.Text = alarmMsg; - } - + { + //娑堟伅 + var btnMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(55 * 2), Application.GetRealHeight(63), false); + btnMsg.Y = Application.GetRealHeight(173); + btnMsg.IsMoreLines = true; + btnMsg.TextAlignment = TextAlignment.Center; + btnMsg.TextColor = UserCenterColor.Current.TextGrayColor1; + btnMsg.Gravity = Gravity.CenterHorizontal; + frameBack.AddChidren(btnMsg); + btnMsg.Text = msgText; + + var alarmMsg = Language.StringByID(R.MyInternationalizationString.XingTip);//.Replace("{0}", "\r\n"); + var btnAlarmMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(55 * 2), Application.GetRealHeight(104), false); + btnAlarmMsg.Y = Application.GetRealHeight(259); + btnAlarmMsg.IsMoreLines = true; + btnAlarmMsg.TextAlignment = TextAlignment.Center; + btnAlarmMsg.TextColor = ZigbeeColor.Current.XMAlarmText; + btnAlarmMsg.Gravity = Gravity.CenterHorizontal; + frameBack.AddChidren(btnAlarmMsg); + btnAlarmMsg.Text = alarmMsg; + } + /// <summary> /// 澶辨晥鏃堕棿璁剧疆鐨勫脊绐楁樉绀� /// </summary> /// <param name="frameMain"></param> /// <param name="frameBack"></param> private void InitInValidTimeDialog(FrameLayout frameBack) - { - //娑堟伅 - string[] msgArray = msgText.Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); - var btnMsg1 = new Button() - { - Width = Application.GetRealWidth(389), - Height = Application.GetRealHeight(180), - Y = Application.GetRealHeight(141), - IsMoreLines = false, - TextColor = UserCenterColor.Current.TextGrayColor1, - TextAlignment = TextAlignment.CenterRight, - Text = msgArray[0], - }; - frameBack.AddChidren(btnMsg1); - - //澶辨晥鏃堕棿璁剧疆 - var editTextFrameLayout = new FrameLayout() - { - Width = Application.GetRealWidth(132), - Height = Application.GetRealHeight(81 + 40 * 2), - Y = Application.GetRealHeight(184 - 40), - X = btnMsg1.Right, - }; - frameBack.AddChidren(editTextFrameLayout); - editInvalidTime = new EditText() - { - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(132), - Y = Application.GetRealHeight(40), - Gravity = Gravity.Center, - Radius = (uint)Application.GetMinRealAverage(17), - BackgroundColor = ZigbeeColor.Current.XMPEditTextBackground, - TextColor = ZigbeeColor.Current.XMBlack, - TextAlignment = TextAlignment.Center, - TextSize = 14, - Text = DoorLockCommonInfo.NormallyOpenModeInvalidTime.ToString(), - PlaceholderTextColor = ZigbeeColor.Current.XMGray3, - IsNumberKeyboardType = true, - }; - editTextFrameLayout.AddChidren(editInvalidTime); + { + //娑堟伅 + string[] msgArray = msgText.Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + var btnMsg1 = new Button() + { + Width = Application.GetRealWidth(389), + Height = Application.GetRealHeight(180), + Y = Application.GetRealHeight(141), + IsMoreLines = false, + TextColor = UserCenterColor.Current.TextGrayColor1, + TextAlignment = TextAlignment.CenterRight, + Text = msgArray[0], + }; + frameBack.AddChidren(btnMsg1); + + //澶辨晥鏃堕棿璁剧疆 + var editTextFrameLayout = new FrameLayout() + { + Width = Application.GetRealWidth(132), + Height = Application.GetRealHeight(81 + 40 * 2), + Y = Application.GetRealHeight(184 - 40), + X = btnMsg1.Right, + }; + frameBack.AddChidren(editTextFrameLayout); + editInvalidTime = new EditText() + { + Height = Application.GetRealHeight(81), + X = Application.GetRealWidth(132), + Y = Application.GetRealHeight(40), + Gravity = Gravity.Center, + Radius = (uint)Application.GetMinRealAverage(17), + BackgroundColor = ZigbeeColor.Current.XMPEditTextBackground, + TextColor = ZigbeeColor.Current.XMBlack, + TextAlignment = TextAlignment.Center, + TextSize = 14, + Text = DoorLockCommonInfo.NormallyOpenModeInvalidTime.ToString(), + PlaceholderTextColor = ZigbeeColor.Current.XMGray3, + IsNumberKeyboardType = true, + }; + editTextFrameLayout.AddChidren(editInvalidTime); editInvalidTime.TextChangeEventHandler += (sender, e) => - { + { if (!string.IsNullOrEmpty((sender as EditText).Text)) { var textFir = (sender as EditText).Text.Substring(0, 1); @@ -286,21 +296,21 @@ } } }; - - var btnMsg2 = new Button() - { - Width = Application.GetRealWidth(271), - Height = Application.GetRealHeight(180), - Y = Application.GetRealHeight(141), - X = editTextFrameLayout.Right, - IsMoreLines = false, - TextColor = UserCenterColor.Current.TextGrayColor1, - TextAlignment = TextAlignment.CenterLeft, - Text = msgArray[1] - }; - frameBack.AddChidren(btnMsg2); - } - + + var btnMsg2 = new Button() + { + Width = Application.GetRealWidth(271), + Height = Application.GetRealHeight(180), + Y = Application.GetRealHeight(141), + X = editTextFrameLayout.Right, + IsMoreLines = false, + TextColor = UserCenterColor.Current.TextGrayColor1, + TextAlignment = TextAlignment.CenterLeft, + Text = msgArray[1] + }; + frameBack.AddChidren(btnMsg2); + } + /// <summary> /// 澶辨晥璁剧疆鐨勫簳閮ㄦ寜閽� /// </summary> @@ -315,8 +325,8 @@ btnDoorLockLogic.ButtonClickEvent += (sender, e) => { //绉婚櫎鐣岄潰 - frameMain.RemoveFromParent(); - //鍥炶皟鍑芥暟 + frameMain.RemoveFromParent(); + //鍥炶皟鍑芥暟 this.LogicClickEvent?.Invoke(); this.LogicClickEvent = null; }; @@ -333,6 +343,46 @@ this.InvalidClickEvent?.Invoke(); this.InvalidClickEvent = null; }; + } + + /// <summary> + /// 澶辨晥鏃堕棿鐨勫簳閮ㄦ寜閽� + /// </summary> + /// <param name="frameMain"></param> + /// <param name="frameBack"></param> + private void InitBottomInvalidTimeButton(FrameLayout frameMain, FrameLayout frameBack) + { + //纭畾鎸夐挳 + var btnConfirm = new BottomRightClickButton(frameBack.Width, Application.GetRealHeight(127)); + frameBack.AddChidren(btnConfirm); + btnConfirm.InitControl(buttonOkText); + btnConfirm.ButtonClickEvent += (sender, e) => + { + string textValue = string.Empty; + if (editInvalidTime != null) + { + textValue = editInvalidTime.Text.Trim(); + if (this.CheckInvalidTime(textValue.TrimStart('0')) == false) + { + return; + } + } + //绉婚櫎鐣岄潰 + frameMain.RemoveFromParent(); + if (msgType == DoorLockMsgType.InValid) + { + if (InvalidTimeAction != null) + { + InvalidTimeAction(textValue); + } + } + else + { + //鍥炶皟鍑芥暟 + this.ConfirmClickEvent?.Invoke(); + this.ConfirmClickEvent = null; + } + }; } /// <summary> @@ -346,16 +396,16 @@ var btnCancel = new BottomLeftClickButton(Application.GetRealWidth(396), Application.GetRealHeight(127)); frameBack.AddChidren(btnCancel); var bottomLeftText = Language.StringByID(R.MyInternationalizationString.uCancel); - if (msgType == DoorLockMsgType.NomallyOpenMode || msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) - { - bottomLeftText = Language.StringByID(R.MyInternationalizationString.KeepNomallyMode); + if (msgType == DoorLockMsgType.NomallyOpenMode || msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) + { + bottomLeftText = Language.StringByID(R.MyInternationalizationString.KeepNomallyMode); } btnCancel.InitControl(bottomLeftText); btnCancel.ButtonClickEvent += (sender, e) => { //绉婚櫎鐣岄潰 - frameMain.RemoveFromParent(); - //鍥炶皟鍑芥暟 + frameMain.RemoveFromParent(); + //鍥炶皟鍑芥暟 this.CancelClickEvent?.Invoke(); this.CancelClickEvent = null; }; @@ -365,39 +415,39 @@ frameBack.AddChidren(btnConfirm); btnConfirm.InitControl(buttonOkText); btnConfirm.ButtonClickEvent += (sender, e) => - { - string textValue = string.Empty; + { + string textValue = string.Empty; if (editInvalidTime != null) { textValue = editInvalidTime.Text.Trim(); if (this.CheckInvalidTime(textValue.TrimStart('0')) == false) { return; - } - } - //绉婚櫎鐣岄潰 + } + } + //绉婚櫎鐣岄潰 frameMain.RemoveFromParent(); - if (msgType == DoorLockMsgType.InValid) - { - if (InvalidTimeAction != null) - { - InvalidTimeAction(textValue); - } - } - else - { - //鍥炶皟鍑芥暟 - this.ConfirmClickEvent?.Invoke(); - this.ConfirmClickEvent = null; - } + if (msgType == DoorLockMsgType.InValid) + { + if (InvalidTimeAction != null) + { + InvalidTimeAction(textValue); + } + } + else + { + //鍥炶皟鍑芥暟 + this.ConfirmClickEvent?.Invoke(); + this.ConfirmClickEvent = null; + } }; - } - + } + /// <summary> /// 妫�娴嬪け鏁堟椂闂� /// </summary> /// <param name="tetxValue"></param> - /// <returns></returns> + /// <returns></returns> private bool CheckInvalidTime(string tetxValue) { if (tetxValue == string.Empty) @@ -438,35 +488,35 @@ return false; } return true; - } - + } + #endregion - + /// <summary> /// 淇℃伅鏄剧ず鐨勭被鍨� /// </summary> - public enum DoorLockMsgType - { + public enum DoorLockMsgType + { /// <summary> /// 纭绫诲瀷 /// </summary> - Confirm = 1, + Confirm = 1, /// <summary> /// 澶辨晥璁剧疆 /// </summary> - InValid = 2, + InValid = 2, /// <summary> /// 閫昏緫绫诲瀷 /// </summary> - DoorLockLogic = 3, + DoorLockLogic = 3, /// <summary> /// 甯稿紑妯″紡 /// </summary> - NomallyOpenMode = 4, + NomallyOpenMode = 4, /// <summary> /// 鍙栨秷甯︽湁閫昏緫鐨勫父寮�妯″紡 /// </summary> - CancelNomallyOpenModeWithLogic = 5, - } - } -} + CancelNomallyOpenModeWithLogic = 5, + } + } +} -- Gitblit v1.8.0