From e96e11d6f8b965ea522c983e040d41e3b9ef105a Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 18 五月 2020 21:33:19 +0800 Subject: [PATCH] 2020-05-18-4 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 44 insertions(+), 9 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs index ad4ea10..9dcce0d 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs @@ -61,10 +61,21 @@ /// 鍋氭垚涓�涓樉绀鸿澶囧洖璺�+鎴块棿鐨凴owLayout /// </summary> /// <param name="i_device">璁惧瀵硅薄</param> - /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param> + /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param> public DeviceRoomControl(CommonDevice i_device, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.mainKey = Common.LocalDevice.Current.GetDeviceMainKeys(i_device); + } + + /// <summary> + /// 鍋氭垚涓�涓樉绀鸿澶囧洖璺�+鎴块棿鐨凴owLayout + /// </summary> + /// <param name="deviceMac">璁惧Mac鍦板潃</param> + /// <param name="deviceEpoint">璁惧绔彛</param> + /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param> + public DeviceRoomControl(string deviceMac, int deviceEpoint, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) + { + this.mainKey = Common.LocalDevice.Current.GetDeviceMainKeys(deviceMac, deviceEpoint); } /// <summary> @@ -72,26 +83,45 @@ /// </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 = HdlRoomLogic.Current.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 = HdlRoomLogic.Current.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; } -- Gitblit v1.8.0