xm
2020-07-21 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d
ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceFunctionUnallocatedControl.cs
New file
@@ -0,0 +1,98 @@
using Shared.Phone.UserCenter;
using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.MainPage.Controls
{
    /// <summary>
    /// 未分配界面的设备功能图标控件
    /// </summary>
    public class DeviceFunctionUnallocatedControl : FrameLayoutStatuControl
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// 背景控件
        /// </summary>
        private PicViewControl btnBackGroud = null;
        /// <summary>
        /// 设备图标控件
        /// </summary>
        private IconViewControl btnDeviceIcon = null;
        /// <summary>
        /// 文本控件
        /// </summary>
        private NormalViewControl btnDeviceName = null;
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 未分配界面的设备功能图标控件
        /// </summary>
        public DeviceFunctionUnallocatedControl()
        {
            this.Width = Application.GetRealWidth(220);
            this.Height = Application.GetRealHeight(279);
            this.UseClickStatu = false;
        }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="text">显示的文本</param>
        /// <param name="unSelectPath">图片1</param>
        /// <param name="selectPath">图片2</param>
        /// <param name="listDevice">设备列表</param>
        public void InitControl(string text, string unSelectPath, string selectPath, List<string> listDevice)
        {
            //背景控件
            this.btnBackGroud = new PicViewControl(150, 173);
            btnBackGroud.Y = Application.GetRealHeight(35);
            btnBackGroud.Gravity = Gravity.CenterHorizontal;
            btnBackGroud.UnSelectedImagePath = "Item/Category_FunctionBG.png";
            btnBackGroud.SelectedImagePath = "Item/Category_FunctionBGSelected.png";
            this.AddChidren(btnBackGroud, ChidrenBindMode.BindEvent);
            //设备图标
            this.btnDeviceIcon = new IconViewControl(84);
            btnDeviceIcon.Y = Application.GetRealHeight(63);
            btnDeviceIcon.UnSelectedImagePath = unSelectPath;
            btnDeviceIcon.SelectedImagePath = selectPath;
            btnDeviceIcon.Gravity = Gravity.CenterHorizontal;
            this.AddChidren(btnDeviceIcon, ChidrenBindMode.BindEvent);
            //文本
            this.btnDeviceName = new NormalViewControl(170, 60, true);
            btnDeviceName.Y = Application.GetRealHeight(200);
            btnDeviceName.Gravity = Gravity.CenterHorizontal;
            btnDeviceName.TextColor = Common.ZigbeeColor.Current.GXCTextBlackColor;
            btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor;
            btnDeviceName.TextSize = 11;
            btnDeviceName.Text = text;
            btnDeviceName.TextAlignment = TextAlignment.Center;
            this.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
        }
        #endregion
        #region ■ 设置状态___________________________
        /// <summary>
        /// 设置选择状态
        /// </summary>
        /// <param name="isSelect"></param>
        public void SetSelectStatu(bool isSelect)
        {
            this.btnBackGroud.IsSelected = isSelect;
            this.btnDeviceIcon.IsSelected = isSelect;
            this.btnDeviceName.IsSelected = isSelect;
            this.btnDeviceName.IsBold = isSelect;
        }
        #endregion
    }
}