From acb2b278663952ce555b06a2e821f359225f15e0 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 10 七月 2020 09:41:15 +0800
Subject: [PATCH] 备份
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 216 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs
new file mode 100755
index 0000000..414fc0d
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs
@@ -0,0 +1,216 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter
+{
+ public class GatewayRowControl : RowLayoutControl
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 缃戝叧ID
+ /// </summary>
+ private string zbGatewayId = string.Empty;
+ /// <summary>
+ /// 缃戝叧瀵硅薄(浼樺厛缂撳瓨鐨勭綉鍏冲璞★紝鍏舵鎵嶆槸鐪熷疄缃戝叧)
+ /// </summary>
+ public ZbGateway zbGateway
+ {
+ get
+ {
+ //鑾峰彇鏈湴缃戝叧瀵硅薄
+ ZbGateway zbway = HdlGatewayLogic.Current.GetLocalGateway(zbGatewayId);
+ if (zbway != null)
+ {
+ return zbway;
+ }
+ //鑾峰彇鐪熷疄鐗╃悊缃戝叧瀵硅薄
+ HdlGatewayLogic.Current.GetRealGateway(ref zbway, zbGatewayId);
+
+ return zbway;
+ }
+ }
+ /// <summary>
+ /// 鏄剧ず鏂囨湰鎺т欢
+ /// </summary>
+ public NormalViewControl btnName = null;
+ /// <summary>
+ /// 鍥炬爣鎺т欢
+ /// </summary>
+ public IconViewControl btnIcon = null;
+ /// <summary>
+ /// 鏄剧ずIP鎺т欢
+ /// </summary>
+ public NormalViewControl btnIp = null;
+
+ /// <summary>
+ /// 鍦ㄧ嚎鐘舵��
+ /// </summary>
+ private bool m_IsOnline = false;
+ /// <summary>
+ /// 鍦ㄧ嚎鐘舵��
+ /// </summary>
+ public bool IsOnline
+ {
+ get { return m_IsOnline; }
+ set
+ {
+ if (m_IsOnline != value)
+ {
+ m_IsOnline = value;
+ //鍙樻洿鐘舵��
+ this.SetOnlineStatu(m_IsOnline);
+ }
+ }
+ }
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
+ /// <summary>
+ /// 鍋氭垚涓�涓樉绀虹綉鍏充俊鎭殑RowLayout,娣诲姞姝ゆ帶浠跺埌瀹瑰櫒鍚庯紝璋冪敤銆怚nitControl()銆戝畬鎴愬垵濮嬪寲
+ /// </summary>
+ /// <param name="i_zbGateway">缃戝叧瀵硅薄</param>
+ /// <param name="ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param>
+ public GatewayRowControl(ZbGateway i_zbGateway, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
+ {
+ this.zbGatewayId = i_zbGateway.GwId;
+ }
+
+ /// <summary>
+ /// 鍒濆鍖栧唴閮ㄦ帶浠�
+ /// </summary>
+ /// <param name="iconSize">宸﹁竟鍥炬爣澶у皬(鏈変簺鐣岄潰鍥炬爣澶у皬涓嶄竴鑷�)</param>
+ public void InitControl(int iconSize)
+ {
+ var tempWay = this.zbGateway;
+
+ //鍥炬爣
+ this.btnIcon = frameTable.AddLeftIcon(iconSize);
+ if (tempWay != null)
+ {
+ HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, tempWay);
+ }
+
+ //鏄剧ず鏂囨湰
+ var wayName = tempWay != null ? HdlGatewayLogic.Current.GetGatewayName(tempWay) : string.Empty;
+ if (wayName == string.Empty)
+ {
+ //鏃犳硶璇嗗埆鐨勭綉鍏宠澶�
+ wayName = Language.StringByID(R.MyInternationalizationString.uUnDistinguishTheGatewayDevice);
+ }
+ else
+ {
+ var value = HdlGatewayLogic.Current.IsMainGateway(this.zbGatewayId);
+ if (value == 1)
+ {
+ //涓荤綉鍏�
+ wayName += "(" + Language.StringByID(R.MyInternationalizationString.uMainGateway) + ")";
+ }
+ else if (value == 2)
+ {
+ //浠庣綉鍏�
+ wayName += "(" + Language.StringByID(R.MyInternationalizationString.uChidrenGateway) + ")";
+ }
+ }
+
+ this.btnName = frameTable.AddLeftCaption(wayName, 700, 60);
+ btnName.TextSize = 15;
+ //杩欎釜鍧愭爣鏈夌偣鐗规畩
+ btnName.Y = Application.GetRealHeight(12) + this.chidrenYaxis;
+ frameTable.AddChidren(btnName, ChidrenBindMode.BindEvent);
+
+ //鎴块棿
+ string strIp = string.Empty;
+ if (tempWay != null)
+ {
+ strIp = tempWay.GwIP;
+ }
+ this.btnIp = frameTable.AddLeftCaption(strIp, 600, 50, true);
+ //杩欎釜鍧愭爣鏈夌偣鐗规畩
+ btnIp.Y = Application.GetRealHeight(72) + this.chidrenYaxis;
+ btnIp.TextSize = 12;
+ btnIp.TextColor = UserCenterColor.Current.TextGrayColor1;
+ frameTable.AddChidren(btnIp, ChidrenBindMode.BindEvent);
+
+ //鍒濆鍊煎湪绾�
+ this.IsOnline = true;
+ }
+
+ #endregion
+
+ #region 鈻� 鍒锋柊鎺т欢___________________________
+
+ /// <summary>
+ /// 鍒锋柊鎺т欢
+ /// </summary>
+ /// <param name="zbway">缃戝叧瀵硅薄(涓簄ull鏃�,浣跨敤鎺т欢鍐呴儴鐨勬暟鎹繘琛屽埛鏂�)</param>
+ public void RefreshControl(ZbGateway zbway)
+ {
+ if (zbway != null)
+ {
+ this.zbGatewayId = zbway.GwId;
+ }
+ bool bonline = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway);
+
+ this.IsOnline = bonline;
+
+ string wayName = HdlGatewayLogic.Current.GetGatewayName(this.zbGateway);
+ var value = HdlGatewayLogic.Current.IsMainGateway(this.zbGatewayId);
+ if (value == 1)
+ {
+ //涓荤綉鍏�
+ wayName += "(" + Language.StringByID(R.MyInternationalizationString.uMainGateway) + ")";
+ }
+ else if (value == 2)
+ {
+ //浠庣綉鍏�
+ wayName += "(" + Language.StringByID(R.MyInternationalizationString.uChidrenGateway) + ")";
+ }
+ this.btnName.Text = wayName;
+ }
+
+ #endregion
+
+ #region 鈻� 鍦ㄧ嚎鐘舵�乢__________________________
+
+ /// <summary>
+ /// 璁剧疆鍦ㄧ嚎鐘舵��
+ /// </summary>
+ /// <param name="online"></param>
+ private void SetOnlineStatu(bool online)
+ {
+ m_IsOnline = online;
+ if (online == false)
+ {
+ btnName.TextColor = UserCenterColor.Current.TextGrayColor2;
+ }
+ else
+ {
+ btnName.TextColor = UserCenterColor.Current.TextColor1;
+ }
+ }
+
+ #endregion
+
+ #region 鈻� 涓�鑸柟娉昣__________________________
+
+ /// <summary>
+ /// 鏇存敼鎺т欢楂樺害
+ /// </summary>
+ /// <param name="i_height">闈炵湡瀹炲��</param>
+ public void ChangedHight(int i_height)
+ {
+ if (frameTable != null)
+ {
+ frameTable.Height = Application.GetRealHeight(i_height);
+ }
+ this.Height = Application.GetRealHeight(i_height);
+ }
+
+ #endregion
+ }
+}
--
Gitblit v1.8.0