From 627093aca723d4bfb971b97c828e8b3a22dbda78 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 17 七月 2020 17:26:19 +0800
Subject: [PATCH] 2020-07-17-1
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs | 185 ++++++++++++++++++---------------------------
1 files changed, 75 insertions(+), 110 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs
index 377f528..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;
@@ -66,15 +76,18 @@
/// </summary>
public void Show()
{
- if (myTip != null)
+ try
{
- myTip.Show(Common.CommonPage.Instance);
- myTip = null;
- return;
+ if (myTip != null)
+ {
+ myTip.Show(Common.CommonPage.Instance);
+ myTip = null;
+ return;
+ }
+ //鍒濆鍖栨帶浠�
+ this.InitMsgControl();
}
-
- //鍒濆鍖栨帶浠�
- this.InitMsgControl();
+ catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex); }
}
#endregion
@@ -86,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();
@@ -104,7 +117,7 @@
frameBack.BackgroundColor = UserCenterColor.Current.White;
frameBack.Y = Application.GetRealHeight(706);
frameBack.Gravity = Gravity.CenterHorizontal;
- frameBack.Radius = 8;
+ frameBack.Radius = (uint)Application.GetRealHeight(17);
frameMain.AddChidren(frameBack);
//鏍囬
var btnTitle = new NormalViewControl(frameBack.Width, Application.GetRealHeight(65), false);
@@ -125,9 +138,13 @@
{
btnTitle.TextID = R.MyInternationalizationString.NormalTip;
}
+ else if (msgType == ShowMsgType.Remind)
+ {
+ btnTitle.TextID = R.MyInternationalizationString.uRemind;
+ }
//娑堟伅
- var btnMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(60 * 2), Application.GetRealHeight(180), false);
+ 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;
@@ -155,105 +172,32 @@
/// <param name="frameBack"></param>
private void InitBottomConfirmButton(FrameLayout frameMain, FrameLayout frameBack)
{
- //鍙栨秷
- var frameCancel = new FrameLayoutControl();
- frameCancel.Height = Application.GetRealHeight(127);
- frameCancel.Width = Application.GetRealWidth(396);
- frameCancel.Gravity = Gravity.BottomLeft;
- frameCancel.Radius = 8;
- frameCancel.BackgroundColor = 0xfff5f6fa;
- frameBack.AddChidren(frameCancel);
- //鎶婁笂鍦嗚瑕嗙洊涓烘柟瑙�
- var btnTopTemp1 = new NormalViewControl(frameCancel.Width, Application.GetRealHeight(40), false);
- btnTopTemp1.BackgroundColor = 0xfff5f6fa;
- frameCancel.AddChidren(btnTopTemp1, ChidrenBindMode.BindEventOnly);
- //鎶婂彸涓嬪渾瑙掕鐩栦负鏂硅
- var btnBomTemp1 = new NormalViewControl(frameCancel.Width / 2, Application.GetRealHeight(40), false);
- btnBomTemp1.BackgroundColor = 0xfff5f6fa;
- btnBomTemp1.Gravity = Gravity.BottomRight;
- frameCancel.AddChidren(btnBomTemp1, ChidrenBindMode.BindEventOnly);
//鍙栨秷鎸夐挳
- var btnCancel = new NormalViewControl(frameCancel.Width - Application.GetRealWidth(10), Application.GetRealHeight(60), false);
- btnCancel.Gravity = Gravity.Center;
- btnCancel.TextColor = UserCenterColor.Current.TextGrayColor1;
- btnCancel.TextID = R.MyInternationalizationString.uCancel;
- btnCancel.TextAlignment = TextAlignment.Center;
- btnCancel.BackgroundColor = 0xfff5f6fa;
- frameCancel.AddChidren(btnCancel, ChidrenBindMode.BindEventOnly);
- frameCancel.ButtonClickEvent += (sender, e) =>
+ var btnCancel = new BottomLeftClickButton(Application.GetRealWidth(396), Application.GetRealHeight(127));
+ frameBack.AddChidren(btnCancel);
+ btnCancel.InitControl(this.buttonCancelText);
+ btnCancel.ButtonClickEvent += (sender, e) =>
{
//绉婚櫎鐣岄潰
frameMain.RemoveFromParent();
+ //鍥炶皟鍑芥暟
+ this.CancelClickEvent?.Invoke();
this.ConfirmClickEvent = null;
- };
- //閲嶅啓鎺т欢鐐瑰嚮鐘舵��
- frameCancel.SelectStatuEvent += (statu) =>
- {
- if (statu == true)
- {
- frameCancel.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
- btnTopTemp1.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
- btnBomTemp1.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
- btnCancel.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
- }
- else
- {
- frameCancel.BackgroundColor = 0xfff5f6fa;
- btnTopTemp1.BackgroundColor = 0xfff5f6fa;
- btnBomTemp1.BackgroundColor = 0xfff5f6fa;
- btnCancel.BackgroundColor = 0xfff5f6fa;
- }
+ this.CancelClickEvent = null;
};
- //纭
- var frameConfirm = new FrameLayoutControl();
- frameConfirm.Height = Application.GetRealHeight(127);
- frameConfirm.Width = Application.GetRealWidth(396);
- frameConfirm.Gravity = Gravity.BottomRight;
- frameConfirm.Radius = 8;
- frameConfirm.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
- frameBack.AddChidren(frameConfirm);
- //鎶婁笂鍦嗚瑕嗙洊涓烘柟瑙�
- var btnTopTemp2 = new NormalViewControl(frameConfirm.Width, Application.GetRealHeight(40), false);
- btnTopTemp2.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
- frameConfirm.AddChidren(btnTopTemp2, ChidrenBindMode.BindEventOnly);
- //鎶婂乏涓嬪渾瑙掕鐩栦负鏂硅
- var btnBomTemp2 = new NormalViewControl(frameConfirm.Width / 2, Application.GetRealHeight(40), false);
- btnBomTemp2.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
- btnBomTemp2.Gravity = Gravity.BottomLeft;
- frameConfirm.AddChidren(btnBomTemp2, ChidrenBindMode.BindEventOnly);
- //纭鎸夐挳
- 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.ButtonClickEvent += (sender, e) =>
+ //纭畾鎸夐挳
+ var btnConfirm = new BottomRightClickButton(frameBack.Width - btnCancel.Width, btnCancel.Height);
+ frameBack.AddChidren(btnConfirm);
+ btnConfirm.InitControl(this.buttonOkText);
+ btnConfirm.ButtonClickEvent += (sender, e) =>
{
//绉婚櫎鐣岄潰
frameMain.RemoveFromParent();
//鍥炶皟鍑芥暟
this.ConfirmClickEvent?.Invoke();
this.ConfirmClickEvent = null;
- };
- //閲嶅啓鎺т欢鐐瑰嚮鐘舵��
- frameConfirm.SelectStatuEvent += (statu) =>
- {
- if (statu == true)
- {
- frameConfirm.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
- btnTopTemp2.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
- btnBomTemp2.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
- btnConfirm.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
- }
- else
- {
- frameConfirm.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
- btnTopTemp2.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
- btnBomTemp2.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
- btnConfirm.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
- }
+ this.CancelClickEvent = null;
};
}
@@ -264,25 +208,26 @@
/// <param name="frameBack"></param>
private void InitBottomNormalButton(FrameLayout frameMain, FrameLayout frameBack)
{
+#if Android
//纭
- var frameConfirm = new FrameLayoutControl();
+ var frameConfirm = new FrameLayoutStatuControl();
frameConfirm.Height = Application.GetRealHeight(127);
frameConfirm.Width = frameBack.Width;
- frameConfirm.Y = Application.GetRealHeight(351);
- frameConfirm.Radius = 8;
+ frameConfirm.Gravity = Gravity.BottomCenter;
+ frameConfirm.RadiusEx = 17;
frameConfirm.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
frameBack.AddChidren(frameConfirm);
//鎶婁笂鍦嗚瑕嗙洊涓烘柟瑙�
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) =>
{
//绉婚櫎鐣岄潰
@@ -307,6 +252,26 @@
btnConfirm.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
}
};
+#endif
+#if iOS
+ //纭鎸夐挳
+ var btnConfirm = new NormalClickButton(frameBack.Width, Application.GetRealHeight(127), false);
+ btnConfirm.Gravity = Gravity.BottomCenter;
+ btnConfirm.TextColor = UserCenterColor.Current.White;
+ btnConfirm.Text = buttonOkText;
+ btnConfirm.TextAlignment = TextAlignment.Center;
+ btnConfirm.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
+ btnConfirm.oldBackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
+ frameBack.AddChidren(btnConfirm);
+ btnConfirm.ButtonClickEvent += (sender, e) =>
+ {
+ //绉婚櫎鐣岄潰
+ frameMain.RemoveFromParent();
+ //鍥炶皟鍑芥暟
+ this.ConfirmClickEvent?.Invoke();
+ this.ConfirmClickEvent = null;
+ };
+#endif
}
#endregion
--
Gitblit v1.8.0