From d78515ac4ac8cf4a1785d9df18058d6724f12b79 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 14 一月 2021 19:34:59 +0800
Subject: [PATCH] 合并xm2021-01-13  wjc2021-02-06

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/TextInputControls/DialogInputControl.cs |  186 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 186 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/TextInputControls/DialogInputControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/TextInputControls/DialogInputControl.cs
new file mode 100644
index 0000000..1e8879a
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/TextInputControls/DialogInputControl.cs
@@ -0,0 +1,186 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// <para>鍋氭垚涓�涓脊绐楀瀷锛屽乏涓嬭鏄�愬彇娑堟寜閽�戯紝鍙充笅瑙掓槸銆愮‘璁ゆ寜閽�戠殑寮圭獥鎺т欢</para>
+    /// <para>New鐨勬椂鍊�,灏卞凡缁忓姞鍏ュ埌浜嗙晫闈�</para>
+    /// </summary>
+    public class DialogInputControl : FrameLayout
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 纭鎸夐挳浜嬩欢
+        /// </summary>
+        public Action<string> ComfirmClickEvent;
+        /// <summary>
+        /// 杈撳叆妗嗙殑鏂囨湰淇℃伅
+        /// </summary>
+        public string Text
+        {
+            get { return txtInput.Text.Trim(); }
+            set { this.txtInput.Text = value; }
+        }
+
+        /// <summary>
+        /// 杈撳叆妗嗘帶浠�
+        /// </summary>
+        private TextInputControl txtInput = null;
+        /// <summary>
+        /// 鏍囬鎺т欢
+        /// </summary>
+        private NormalViewControl btnTitle = null;
+        /// <summary>
+        /// 鍙栨秷鎸夐挳
+        /// </summary>
+        private BottomLeftClickButton btnCancel = null;
+        /// <summary>
+        /// 纭鎸夐挳
+        /// </summary>
+        private BottomRightClickButton btnConfirm = null;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// <para>鍋氭垚涓�涓脊绐楀瀷锛屽乏涓嬭鏄�愬彇娑堟寜閽�戯紝鍙充笅瑙掓槸銆愮‘璁ゆ寜閽�戠殑寮圭獥鎺т欢</para>
+        /// <para>New鐨勬椂鍊�,灏卞凡缁忓姞鍏ュ埌浜嗙晫闈�</para>
+        /// </summary>
+        /// <param name="i_MaxByte">鏂囨湰妗嗘渶澶ц緭鍏ョ殑byte鏁�(榛樿36涓猙yte)</param>
+        public DialogInputControl(int i_MaxByte = 36)
+        {
+            //娣诲姞鐣岄潰
+            var nowForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
+            if (nowForm == null || (nowForm is ViewGroup) == false)
+            {
+                return;
+            }
+            this.BackgroundColor = UserCenterColor.Current.DialogBackColor;
+            ((ViewGroup)nowForm).AddChidren(this);
+
+            //鐧借壊鑳屾櫙妗�
+            var frameBack = new FrameLayout();
+            frameBack.Height = Application.GetRealHeight(507);
+            frameBack.Width = Application.GetRealWidth(792);
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            frameBack.Y = Application.GetRealHeight(691);
+            frameBack.Gravity = Gravity.CenterHorizontal;
+            frameBack.Radius = (uint)Application.GetRealHeight(17);
+            this.AddChidren(frameBack);
+            //鏍囬淇℃伅
+            this.btnTitle = new NormalViewControl(frameBack.Width, Application.GetRealHeight(65), false);
+            btnTitle.Y = Application.GetRealHeight(68);
+            btnTitle.TextColor = UserCenterColor.Current.TextColor1;
+            btnTitle.TextSize = 16;
+            btnTitle.TextAlignment = TextAlignment.Center;
+            frameBack.AddChidren(btnTitle);
+
+            //鍒濆鍖栬竟妗�
+            var frameText = new FrameLayout();
+            frameText.Width = Application.GetRealWidth(677);
+            frameText.Height = Application.GetRealHeight(100);
+            frameText.Y = Application.GetRealHeight(198);
+            frameText.Gravity = Gravity.CenterHorizontal;
+            frameText.BorderColor = 0xff676767;
+            frameText.BorderWidth = 1;
+            frameText.Radius = (uint)Application.GetRealHeight(17);
+            frameBack.AddChidren(frameText);
+            //杈撳叆妗�
+            this.txtInput = new TextInputControl(frameText.Width - Application.GetRealWidth(20), frameText.Height, false);
+            txtInput.TextAlignment = TextAlignment.Center;
+            txtInput.Gravity = Gravity.CenterHorizontal;
+            frameText.AddChidren(txtInput);
+            if (i_MaxByte > 0)
+            {
+                this.txtInput.MaxByte = i_MaxByte;
+            }
+
+            //鍙栨秷
+            this.btnCancel = new BottomLeftClickButton(Application.GetRealWidth(396), Application.GetRealHeight(127));
+            frameBack.AddChidren(btnCancel);
+            btnCancel.InitControl(Language.StringByID(R.MyInternationalizationString.uCancel));
+            btnCancel.ButtonClickEvent += (sender, e) =>
+            {
+                //绉婚櫎鐣岄潰
+                this.CloseDialog();
+            };
+
+            //纭
+            this.btnConfirm = new BottomRightClickButton(frameBack.Width - btnCancel.Width, btnCancel.Height);
+            frameBack.AddChidren(btnConfirm);
+            btnConfirm.InitControl(Language.StringByID(R.MyInternationalizationString.OkMsg));
+            btnConfirm.ButtonClickEvent += (sender, e) =>
+            {
+                if (this.Text == string.Empty && string.IsNullOrEmpty(this.txtInput.PlaceholderText) == false)
+                {
+                    var alert = new ShowMsgControl(ShowMsgType.Tip, this.txtInput.PlaceholderText);
+                    alert.Show();
+                    return;
+                }
+                //鍥炶皟鍑芥暟
+                this.ComfirmClickEvent?.Invoke(this.Text);
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 鐢婚潰鍏抽棴
+        /// </summary>
+        public void CloseDialog()
+        {
+            this.ComfirmClickEvent = null;
+            this.RemoveFromParent();
+        }
+
+        #endregion
+
+        #region 鈻� 璁剧疆淇℃伅___________________________
+
+        /// <summary>
+        /// 璁剧疆鏍囬淇℃伅
+        /// </summary>
+        /// <param name="txtValue"></param>
+        public void SetTitleText(string txtValue)
+        {
+            this.btnTitle.Text = txtValue;
+        }
+        /// <summary>
+        /// 璁剧疆鍙栨秷鎸夐挳鐨勬枃鏈俊鎭�
+        /// </summary>
+        /// <param name="txtValue"></param>
+        public void SetCancelButtonText(string txtValue)
+        {
+            this.btnCancel.SetButtonText(txtValue);
+        }
+
+        /// <summary>
+        /// 璁剧疆纭畾鎸夐挳鐨勬枃鏈俊鎭�
+        /// </summary>
+        /// <param name="txtValue"></param>
+        public void SetOkButtonText(string txtValue)
+        {
+            this.btnConfirm.SetButtonText(txtValue);
+        }
+
+        /// <summary>
+        /// 璁剧疆杈撳叆妗嗙伆鑹插瓧浣撹鏄�
+        /// </summary>
+        /// <param name="txtValue"></param>
+        public void SetTipText(string txtValue)
+        {
+            if (this.txtInput != null)
+            {
+                this.txtInput.PlaceholderText = txtValue;
+            }
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0