From 18a7f9f40e5fab3bee5d4ac3d8fd0273dea052d6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期日, 26 四月 2020 12:05:28 +0800
Subject: [PATCH] 先上传一个非最新的版本
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs | 88 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 80 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 120d887..f6e6474 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs
@@ -24,6 +24,23 @@
get { return Common.LocalDevice.Current.GetDevice(mainKey); }
}
/// <summary>
+ /// 鍦ㄧ嚎鐘舵��
+ /// </summary>
+ private bool m_isOnline = false;
+ /// <summary>
+ /// 鍦ㄧ嚎鐘舵��
+ /// </summary>
+ public bool isOnline
+ {
+ get { return m_isOnline; }
+ set
+ {
+ m_isOnline = value;
+ //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
+ this.SetOnlineStatu(m_isOnline);
+ }
+ }
+ /// <summary>
/// 鍥炬爣鎺т欢
/// </summary>
public IconViewControl btnIcon = null;
@@ -51,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 = HdlRoomLogic.Current.GetRoomNameByDevice(tempDevice);
+ }
+ else
+ {
+ //鏈垎閰嶅尯鍩�
+ btnRoom.Text = Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
+ btnRoom.TextColor = 0xfff62f48;
+ }
}
#endregion
@@ -87,15 +134,40 @@
/// <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;
}
#endregion
+
+ #region 鈻� 涓�鑸柟娉昣__________________________
+
+ /// <summary>
+ /// 璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
+ /// </summary>
+ /// <param name="isOnline"></param>
+ private void SetOnlineStatu(bool isOnline)
+ {
+ if (isOnline == false)
+ {
+ btnDevie.TextColor = UserCenterColor.Current.TextGrayColor1;
+ }
+ else
+ {
+ btnDevie.TextColor = UserCenterColor.Current.TextColor1;
+ }
+ }
+
+ #endregion
}
}
--
Gitblit v1.8.0