From c7698e163e43cea9e7f8ee45f8e3f91c9265cca4 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 04 十一月 2019 19:11:41 +0800 Subject: [PATCH] 合并了全部的代码 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 43 insertions(+), 8 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..1bb995a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs @@ -68,30 +68,60 @@ } /// <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> /// 鍒濆鍖栧唴閮ㄦ帶浠� /// </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; } -- Gitblit v1.8.0