From e22fdb94322e6cec38e5e4a9aec13d431a133fde Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 28 四月 2020 16:32:35 +0800
Subject: [PATCH] 上传合并后的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs |  362 +++++++++++++++++++++++++++------------------------
 1 files changed, 191 insertions(+), 171 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs
index de6bb06..ea5123d 100755
--- 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); }
@@ -121,24 +121,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 +148,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,127 +160,147 @@
 
             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)
             {
                 //鍒濆鍖栫‘璁ょ被鍨嬬殑搴曢儴鎸夐挳
                 this.InitBottomConfirmButton(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);
-
-
-            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);
-        }
-
+        {
+            //娑堟伅 
+            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);
+                    if ((sender as EditText).Text.Length > 1)
+                    {
+                        if (textFir == "0")
+                        {
+                            editInvalidTime.Text = (sender as EditText).Text.Substring(1, 1);
+                        }
+                    }
+                    if (int.Parse((sender as EditText).Text) > 72)
+                    {
+                        string msg0 = Language.StringByID(R.MyInternationalizationString.InvalidTimeMoreThan72);
+                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, msg0, Language.StringByID(R.MyInternationalizationString.confrim));
+                        alert.Show();
+                        editInvalidTime.Text = "72";
+                    }
+                }
+            };
+
+            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>
@@ -295,8 +315,8 @@
             btnDoorLockLogic.ButtonClickEvent += (sender, e) =>
             {
                 //绉婚櫎鐣岄潰
-                frameMain.RemoveFromParent();
-                //鍥炶皟鍑芥暟
+                frameMain.RemoveFromParent();
+                //鍥炶皟鍑芥暟
                 this.LogicClickEvent?.Invoke();
                 this.LogicClickEvent = null;
             };
@@ -326,16 +346,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;
             };
@@ -345,39 +365,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)
@@ -418,35 +438,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