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/CommonBase/Controls/MessageControls/ShowMsgControl.cs | 44 +++++++++++++++++++++++++++++--------------- 1 files changed, 29 insertions(+), 15 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs index c0fc2a1..c4d31b4 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs @@ -15,6 +15,10 @@ /// </summary> public Action ConfirmClickEvent = null; /// <summary> + /// 鐐瑰嚮鍙栨秷鐨勪簨浠� + /// </summary> + public Action CancelClickEvent = null; + /// <summary> /// 淇℃伅绫诲瀷 /// </summary> private ShowMsgType msgType = ShowMsgType.Confirm; @@ -26,6 +30,10 @@ /// 纭鎸夐挳鐨勬枃鏈� /// </summary> private string buttonOkText = null; + /// <summary> + /// 鍙栨秷鎸夐挳鐨勬枃鏈� + /// </summary> + private string buttonCancelText = null; /// <summary> /// 鎻愮ず鎺т欢 /// </summary> @@ -40,11 +48,13 @@ /// </summary> /// <param name="i_msgType">淇℃伅绫诲瀷</param> /// <param name="i_msg">淇℃伅</param> - /// <param name="buttonText">纭鎸夐挳鐨勬枃鏈�</param> - public ShowMsgControl(ShowMsgType i_msgType, string i_msg, string buttonText = null) + /// <param name="i_buttonOkText">纭鎸夐挳鐨勬枃鏈�</param> + /// <param name="i_buttonCancelText">鍙栨秷鎸夐挳鐨勬枃鏈�</param> + public ShowMsgControl(ShowMsgType i_msgType, string i_msg, string i_buttonOkText = null, string i_buttonCancelText = null) { //纭鎸夐挳鏂囨湰 - this.buttonOkText = buttonText == null ? Language.StringByID(R.MyInternationalizationString.OkMsg) : buttonText; + this.buttonOkText = i_buttonOkText == null ? Language.StringByID(R.MyInternationalizationString.OkMsg) : i_buttonOkText; + this.buttonCancelText = i_buttonCancelText == null ? Language.StringByID(R.MyInternationalizationString.uCancel) : i_buttonCancelText; this.msgType = i_msgType; this.msgText = i_msg; @@ -89,16 +99,16 @@ /// </summary> private void InitMsgControl() { - //娣诲姞鐣岄潰 - var nowForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); - if (nowForm == null || (nowForm is ViewGroup) == false) - { - return; - } //涓绘帶浠� var frameMain = new FrameLayout(); frameMain.BackgroundColor = UserCenterColor.Current.DialogBackColor; - ((ViewGroup)nowForm).AddChidren(frameMain); + Common.CommonPage.Instance.AddChidren(frameMain); + frameMain.MouseUpEventHandler += (sender, e) => + { + //绉婚櫎鐣岄潰 + frameMain.RemoveFromParent(); + this.ConfirmClickEvent = null; + }; //鐧借壊鑳屾櫙妗� var frameBack = new FrameLayout(); @@ -165,18 +175,21 @@ //鍙栨秷鎸夐挳 var btnCancel = new BottomLeftClickButton(Application.GetRealWidth(396), Application.GetRealHeight(127)); frameBack.AddChidren(btnCancel); - btnCancel.InitControl(Language.StringByID(R.MyInternationalizationString.uCancel)); + btnCancel.InitControl(this.buttonCancelText); btnCancel.ButtonClickEvent += (sender, e) => { //绉婚櫎鐣岄潰 frameMain.RemoveFromParent(); + //鍥炶皟鍑芥暟 + this.CancelClickEvent?.Invoke(); this.ConfirmClickEvent = null; + this.CancelClickEvent = null; }; //纭畾鎸夐挳 var btnConfirm = new BottomRightClickButton(frameBack.Width - btnCancel.Width, btnCancel.Height); frameBack.AddChidren(btnConfirm); - btnConfirm.InitControl(buttonOkText); + btnConfirm.InitControl(this.buttonOkText); btnConfirm.ButtonClickEvent += (sender, e) => { //绉婚櫎鐣岄潰 @@ -184,6 +197,7 @@ //鍥炶皟鍑芥暟 this.ConfirmClickEvent?.Invoke(); this.ConfirmClickEvent = null; + this.CancelClickEvent = null; }; } @@ -196,7 +210,7 @@ { #if Android //纭 - var frameConfirm = new FrameLayoutControl(); + var frameConfirm = new FrameLayoutStatuControl(); frameConfirm.Height = Application.GetRealHeight(127); frameConfirm.Width = frameBack.Width; frameConfirm.Gravity = Gravity.BottomCenter; @@ -206,14 +220,14 @@ //鎶婁笂鍦嗚瑕嗙洊涓烘柟瑙� var btnTopTemp2 = new NormalViewControl(frameConfirm.Width, Application.GetRealHeight(35), false); btnTopTemp2.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor; - frameConfirm.AddChidren(btnTopTemp2, ChidrenBindMode.BindEventOnly); + frameConfirm.AddChidren(btnTopTemp2, ChidrenBindMode.BindEvent); //纭鎸夐挳 var btnConfirm = new NormalViewControl(frameConfirm.Width - Application.GetRealWidth(10), Application.GetRealHeight(60), false); btnConfirm.Gravity = Gravity.Center; btnConfirm.TextColor = UserCenterColor.Current.White; btnConfirm.Text = buttonOkText; btnConfirm.TextAlignment = TextAlignment.Center; - frameConfirm.AddChidren(btnConfirm, ChidrenBindMode.BindEventOnly); + frameConfirm.AddChidren(btnConfirm, ChidrenBindMode.BindEvent); frameConfirm.ButtonClickEvent += (sender, e) => { //绉婚櫎鐣岄潰 -- Gitblit v1.8.0