HDL Home App 第二版本 旧平台金堂用 正在使用
chenqiyang
2022-06-22 dc0309e64f02227d8e1468b7326c07955f804612
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs
old mode 100755 new mode 100644
@@ -1,133 +1,133 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 位于左下角的单击控件
    /// </summary>
    public class BottomLeftClickButton : FrameLayoutControl
    {
        #region ■ 变量声明___________________________
#if Android
        /// <summary>
        /// 按钮(没初始化之前,它为null)
        /// </summary>
        private NormalViewControl btnButton = null;
        /// <summary>
        /// 顶部圆角
        /// </summary>
        private NormalViewControl btnTopTemp = null;
        /// <summary>
        /// 左下角圆角
        /// </summary>
        private NormalViewControl btnBomTemp = null;
#endif
#if iOS
        /// <summary>
        /// 按钮(没初始化之前,它为null)
        /// </summary>
        private NormalClickButton btnButton = null;
#endif
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 位于左下角的单击控件
        /// </summary>
        /// <param name="i_width">宽度,真实值</param>
        /// <param name="i_height">高度,真实值</param>
        /// <param name="i_radius">圆角度(只对安卓有效)</param>
        public BottomLeftClickButton(int i_width, int i_height, int i_radius = 17)
        {
            this.Height = i_height;
            this.Width = i_width;
            this.Gravity = Gravity.BottomLeft;
#if Android
            this.RadiusEx = i_radius;
#endif
        }
        /// <summary>
        /// 初始化控件
        /// </summary>
        /// <param name="i_text">文本信息</param>
        public void InitControl(string i_text)
        {
            uint i_backColor = 0xfff5f6fa;
#if Android
            this.BackgroundColor = i_backColor;
            //把上圆角覆盖为方角
            this.btnTopTemp = new NormalViewControl(this.Width, Application.GetRealHeight(40), false);
            btnTopTemp.BackgroundColor = i_backColor;
            this.AddChidren(btnTopTemp, ChidrenBindMode.BindEventOnly);
            //把右下圆角覆盖为方角
            this.btnBomTemp = new NormalViewControl(this.Width / 2, Application.GetRealHeight(40), false);
            btnBomTemp.BackgroundColor = i_backColor;
            btnBomTemp.Gravity = Gravity.BottomRight;
            this.AddChidren(btnBomTemp, ChidrenBindMode.BindEventOnly);
            //取消按钮
            this.btnButton = new NormalViewControl(this.Width - Application.GetRealWidth(10), Application.GetRealHeight(60), false);
            btnButton.Gravity = Gravity.Center;
            btnButton.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnButton.Text = i_text;
            btnButton.TextAlignment = TextAlignment.Center;
            btnButton.BackgroundColor = i_backColor;
            this.AddChidren(btnButton, ChidrenBindMode.BindEventOnly);
            //重写控件点击状态
            this.SelectStatuEvent += (statu) =>
            {
                if (statu == true)
                {
                    this.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
                    btnTopTemp.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
                    btnBomTemp.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
                    btnButton.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
                }
                else
                {
                    this.BackgroundColor = i_backColor;
                    btnTopTemp.BackgroundColor = i_backColor;
                    btnBomTemp.BackgroundColor = i_backColor;
                    btnButton.BackgroundColor = i_backColor;
                }
            };
#endif
#if iOS
            //取消按钮
            this.btnButton = new NormalClickButton(this.Width, this.Height, false);
            btnButton.Gravity = Gravity.BottomLeft;
            btnButton.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnButton.Text = i_text;
            btnButton.TextAlignment = TextAlignment.Center;
            btnButton.BackgroundColor = i_backColor;
            btnButton.oldBackgroundColor = i_backColor;
            this.AddChidren(btnButton, ChidrenBindMode.BindEventOnly);
#endif
        }
        #endregion
        #region ■ 一般方法___________________________
        /// <summary>
        /// 设置按钮的文本信息
        /// </summary>
        /// <param name="txtValue"></param>
        public void SetButtonText(string txtValue)
        {
            if (this.btnButton != null)
            {
                this.btnButton.Text = txtValue;
            }
        }
        #endregion
    }
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 位于左下角的单击控件
    /// </summary>
    public class BottomLeftClickButton : FrameLayoutStatuControl
    {
        #region ■ 变量声明___________________________
#if Android
        /// <summary>
        /// 按钮(没初始化之前,它为null)
        /// </summary>
        private NormalViewControl btnButton = null;
        /// <summary>
        /// 顶部圆角
        /// </summary>
        private NormalViewControl btnTopTemp = null;
        /// <summary>
        /// 左下角圆角
        /// </summary>
        private NormalViewControl btnBomTemp = null;
#endif
#if iOS
        /// <summary>
        /// 按钮(没初始化之前,它为null)
        /// </summary>
        private NormalClickButton btnButton = null;
#endif
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 位于左下角的单击控件
        /// </summary>
        /// <param name="i_width">宽度,真实值</param>
        /// <param name="i_height">高度,真实值</param>
        /// <param name="i_radius">圆角度(只对安卓有效)</param>
        public BottomLeftClickButton(int i_width, int i_height, int i_radius = 17)
        {
            this.Height = i_height;
            this.Width = i_width;
            this.Gravity = Gravity.BottomLeft;
#if Android
            this.RadiusEx = i_radius;
#endif
        }
        /// <summary>
        /// 初始化控件
        /// </summary>
        /// <param name="i_text">文本信息</param>
        public void InitControl(string i_text)
        {
            uint i_backColor = 0xfff5f6fa;
#if Android
            this.BackgroundColor = i_backColor;
            //把上圆角覆盖为方角
            this.btnTopTemp = new NormalViewControl(this.Width, Application.GetRealHeight(40), false);
            btnTopTemp.BackgroundColor = i_backColor;
            this.AddChidren(btnTopTemp, ChidrenBindMode.BindEvent);
            //把右下圆角覆盖为方角
            this.btnBomTemp = new NormalViewControl(this.Width / 2, Application.GetRealHeight(40), false);
            btnBomTemp.BackgroundColor = i_backColor;
            btnBomTemp.Gravity = Gravity.BottomRight;
            this.AddChidren(btnBomTemp, ChidrenBindMode.BindEvent);
            //取消按钮
            this.btnButton = new NormalViewControl(this.Width - Application.GetRealWidth(10), Application.GetRealHeight(60), false);
            btnButton.Gravity = Gravity.Center;
            btnButton.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnButton.Text = i_text;
            btnButton.TextAlignment = TextAlignment.Center;
            btnButton.BackgroundColor = i_backColor;
            this.AddChidren(btnButton, ChidrenBindMode.BindEvent);
            //重写控件点击状态
            this.SelectStatuEvent += (statu) =>
            {
                if (statu == true)
                {
                    this.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
                    btnTopTemp.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
                    btnBomTemp.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
                    btnButton.BackgroundColor = UserCenterColor.Current.ButtonClickStatuColor;
                }
                else
                {
                    this.BackgroundColor = i_backColor;
                    btnTopTemp.BackgroundColor = i_backColor;
                    btnBomTemp.BackgroundColor = i_backColor;
                    btnButton.BackgroundColor = i_backColor;
                }
            };
#endif
#if iOS
            //取消按钮
            this.btnButton = new NormalClickButton(this.Width, this.Height, false);
            btnButton.Gravity = Gravity.BottomLeft;
            btnButton.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnButton.Text = i_text;
            btnButton.TextAlignment = TextAlignment.Center;
            btnButton.BackgroundColor = i_backColor;
            btnButton.oldBackgroundColor = i_backColor;
            this.AddChidren(btnButton, ChidrenBindMode.BindEvent);
#endif
        }
        #endregion
        #region ■ 一般方法___________________________
        /// <summary>
        /// 设置按钮的文本信息
        /// </summary>
        /// <param name="txtValue"></param>
        public void SetButtonText(string txtValue)
        {
            if (this.btnButton != null)
            {
                this.btnButton.Text = txtValue;
            }
        }
        #endregion
    }
}