HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-11-04 c7698e163e43cea9e7f8ee45f8e3f91c9265cca4
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs
@@ -68,30 +68,60 @@
        }
        /// <summary>
        /// 做成一个显示设备回路+房间的RowLayout
        /// </summary>
        /// <param name="deviceMac">设备Mac地址</param>
        /// <param name="deviceEpoint">设备端口</param>
        /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param>
        public DeviceRoomControl(string deviceMac, int deviceEpoint, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
        {
            this.mainKey = Common.LocalDevice.Current.GetDeviceMainKeys(deviceMac, deviceEpoint);
        }
        /// <summary>
        /// 初始化内部控件
        /// </summary>
        public void InitControl()
        {
            var tempDevice = device;
            //图标
            btnIcon = frameTable.AddLeftIcon();
            Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device);
            Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, tempDevice);
            //设备
            string eName = Common.LocalDevice.Current.GetDeviceEpointName(device);
            btnDevie = frameTable.AddLeftCaption(eName, 600, 60);
            btnDevie = frameTable.AddLeftCaption("", 600, 60);
            btnDevie.TextSize = 15;
            //这个坐标有点特殊
            btnDevie.Y = Application.GetRealHeight(12) + this.chidrenYaxis;
            frameTable.AddChidren(btnDevie, ChidrenBindMode.BindEventOnly);
            if (tempDevice != null)
            {
                btnDevie.Text = Common.LocalDevice.Current.GetDeviceEpointName(tempDevice);
            }
            else
            {
                //无法识别的设备
                btnDevie.Text = Language.StringByID(R.MyInternationalizationString.uUnDistinguishTheDevice);
                btnDevie.TextColor = 0xfff62f48;
            }
            //房间
            string roomName = Common.Room.CurrentRoom.GetRoomNameByDevice(device);
            btnRoom = frameTable.AddLeftCaption(roomName, 600, 50, true);
            btnRoom = frameTable.AddLeftCaption("", 600, 50, true);
            //这个坐标有点特殊
            btnRoom.Y = Application.GetRealHeight(72) + this.chidrenYaxis;
            btnRoom.TextSize = 12;
            btnRoom.TextColor = UserCenterColor.Current.TextGrayColor1;
            frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEventOnly);
            if (tempDevice != null)
            {
                btnRoom.Text = Common.Room.CurrentRoom.GetRoomNameByDevice(tempDevice);
            }
            else
            {
                //未分配区域
                btnRoom.Text = Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
                btnRoom.TextColor = 0xfff62f48;
            }
        }
        #endregion
@@ -104,12 +134,17 @@
        /// <param name="i_device"></param>
        public void RefreshControlInfo()
        {
            btnDevie.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
            btnRoom.Text = Common.Room.CurrentRoom.GetRoomNameByDevice(device);
            var tempDevice = device;
            if (tempDevice == null)
            {
                return;
            }
            btnDevie.Text = Common.LocalDevice.Current.GetDeviceEpointName(tempDevice);
            btnRoom.Text = Common.Room.CurrentRoom.GetRoomNameByDevice(tempDevice);
            string unSelectPath = string.Empty;
            string selectPath = string.Empty;
            Common.LocalDevice.Current.GetDeviceIcon(device, ref unSelectPath, ref selectPath);
            Common.LocalDevice.Current.GetDeviceIcon(tempDevice, ref unSelectPath, ref selectPath);
            btnIcon.UnSelectedImagePath = unSelectPath;
        }