From f71e74b5f0d2716fbf05da016cdaa18d64e09f80 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 31 十二月 2020 17:01:18 +0800 Subject: [PATCH] 又换完成最新门锁。空气质量传感器完成数据和基本配置功能。开发图表和自动化的同事可下载此代码 --- ZigbeeApp/Shared/Phone/SmartSound/Widget/TextDialog.cs | 143 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 143 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/SmartSound/Widget/TextDialog.cs b/ZigbeeApp/Shared/Phone/SmartSound/Widget/TextDialog.cs new file mode 100755 index 0000000..523da8f --- /dev/null +++ b/ZigbeeApp/Shared/Phone/SmartSound/Widget/TextDialog.cs @@ -0,0 +1,143 @@ +锘縰sing System; + +namespace Shared.Phone.UserCenter.SmartSound.Widget +{ + + public class TextDialog : FrameLayout + { + + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 纭鎸夐挳浜嬩欢 + /// </summary> + public Action ComfirmClickEvent; + + /// <summary> + /// 鏍囬鎺т欢 + /// </summary> + private NormalViewControl btnTitle = null; + /// <summary> + /// 鍙栨秷鎸夐挳 + /// </summary> + private BottomLeftClickButton btnCancel = null; + /// <summary> + /// 纭鎸夐挳 + /// </summary> + private BottomRightClickButton btnConfirm = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// + /// </summary> + /// <param name="msg">鎻愮ず鍐呭</param> + /// <param name="btnText">纭鎸夐挳 Text</param> + public TextDialog(string msg,string btnText) + { + //娣诲姞鐣岄潰 + 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 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; + btnMsg.Text = msg; + frameBack.AddChidren(btnMsg); + + //鍙栨秷 + 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(btnText); + btnConfirm.ButtonClickEvent += (sender, e) => + { + //鍥炶皟鍑芥暟 + this.ComfirmClickEvent?.Invoke(); + }; + } + + #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); + } + + #endregion + } +} -- Gitblit v1.8.0