xm
2020-04-16 6fa9d69da922c8049f5acfcbb9ce9fd26811024c
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/RowLayoutControl.cs
New file
@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 做成一个点击能够显示选中状态背景色的RowLayout(拥有桌布)
    /// </summary>
    public class RowLayoutControl : RowLayout
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// 桌布控件
        /// </summary>
        private FrameRowControl m_frameTable = null;
        /// <summary>
        /// 桌布控件
        /// </summary>
        public FrameRowControl frameTable
        {
            get
            {
                if (m_frameTable == null) { this.InitFrameTableControl(); }
                return m_frameTable;
            }
        }
        /// <summary>
        /// 此控件的识别主键(自定义设置的)
        /// </summary>
        public string MainKeys = string.Empty;
        /// <summary>
        /// 子控件Y轴偏移量(共通定义而已,有些界面需要这种特殊操作)
        /// </summary>
        public int chidrenYaxis = 0;
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 做成一个点击能够显示选中状态背景色的RowLayout(拥有桌布)
        /// </summary>
        /// <param name="ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param>
        public RowLayoutControl(int i_ChidrenYaxis = 0)
        {
            this.LineColor = UserCenterColor.Current.Transparent;
            this.SubViewWidth = Application.GetRealWidth(184);
            this.chidrenYaxis = i_ChidrenYaxis;
            this.Height = ControlCommonResourse.ListViewRowHeight;
            this.Width = Application.CurrentWidth;
        }
        /// <summary>
        /// 初始化桌布控件
        /// </summary>
        private void InitFrameTableControl()
        {
            this.m_frameTable = new FrameRowControl(chidrenYaxis);
            this.m_frameTable.Height = this.Height;
            base.AddChidren(frameTable);
        }
        #endregion
        #region ■ 添加删除控件_______________________
        /// <summary>
        /// 添加删除控件
        /// </summary>
        /// <returns></returns>
        public NormalViewControl AddDeleteControl()
        {
            //删除
            var btnDelete = new NormalViewControl(Application.GetRealWidth(184), this.Height, false);
            btnDelete.BackgroundColor = 0xfff75858;
            btnDelete.TextSize = 12;
            btnDelete.TextColor = UserCenterColor.Current.White;
            btnDelete.TextAlignment = TextAlignment.Center;
            btnDelete.TextID = R.MyInternationalizationString.uDelete;
            this.AddRightView(btnDelete);
            return btnDelete;
        }
        #endregion
        #region ■ 添加编辑控件_______________________
        /// <summary>
        /// 添加编辑控件
        /// </summary>
        /// <param name="hideMenuByClick">点击时,是否隐藏左滑菜单</param>
        /// <returns></returns>
        public NormalViewControl AddEditorControl(bool hideMenuByClick = true)
        {
            var btnEditor = new NormalViewControl(Application.GetRealWidth(184), this.Height, false);
            btnEditor.BackgroundColor = 0xff4a4a4a;
            btnEditor.TextSize = 12;
            btnEditor.TextColor = UserCenterColor.Current.White;
            btnEditor.TextAlignment = TextAlignment.Center;
            btnEditor.TextID = R.MyInternationalizationString.uEditor;
            this.AddRightView(btnEditor);
            if (hideMenuByClick == true)
            {
                btnEditor.ButtonClickEvent += (sender, e) =>
                {
                    //关闭左滑菜单
                    this.HideMenu();
                };
            }
            return btnEditor;
        }
        #endregion
    }
}