黄学彪
2019-10-18 97e259d966cb5cb5d73c105d5dbaadcc1f920614
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs
@@ -32,19 +32,14 @@
                return zbway;
            }
        }
        /// <summary>
        /// 图标控件
        /// </summary>
        public IconViewControl btnIcon = null;
        /// <summary>
        /// 显示文本控件
        /// </summary>
        public NormalViewControl btnName = null;
        /// <summary>
        /// 在线状态的控件
        /// 显示IP控件
        /// </summary>
        public NormalViewControl btnOnline = null;
        private NormalViewControl btnIp = null;
        /// <summary>
        /// 在线状态
@@ -87,7 +82,7 @@
            var tempWay = this.zbGateway;
            //图标
            this.btnIcon = frameTable.AddLeftIcon(iconSize);
            var btnIcon = frameTable.AddLeftIcon(iconSize);
            if (tempWay != null)
            {
                HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, tempWay);
@@ -100,10 +95,35 @@
                //无法识别的网关设备
                wayName = Language.StringByID(R.MyInternationalizationString.uUnDistinguishTheGatewayDevice);
            }
            this.btnName = frameTable.AddLeftCaption(wayName, 700);
            this.btnName.Text = wayName;
            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) + ")";
                }
            }
            tempWay = null;
            this.btnName = frameTable.AddLeftCaption(wayName, 700, 60);
            btnName.TextSize = 15;
            //这个坐标有点特殊
            btnName.Y = Application.GetRealHeight(12) + this.chidrenYaxis;
            frameTable.AddChidren(btnName, ChidrenBindMode.BindEventOnly);
            //房间
            string strIp = HdlGatewayLogic.Current.GetGatewayBaseInfoAttribute(tempWay, "IpAddress").ToString();
            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.BindEventOnly);
        }
        #endregion
@@ -120,38 +140,28 @@
            {
                this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(zbway);
            }
            ZbGateway realWay = null;
            bool bonline = false;
            if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, this.zbGatewayId) == true)
            {
                bonline = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(realWay);
            }
            bool bonline = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway);
            this.IsOnline = bonline;
            this.btnName.Text = HdlGatewayLogic.Current.GetGatewayName(this.zbGateway);
            realWay = null;
            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>
        public void AddOnLineControl()
        {
            this.btnOnline = frameTable.AddMostRightView(string.Empty, 270);
            ZbGateway realWay = null;
            bool bonline = false;
            if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, zbGateway) == true)
            {
                bonline = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(realWay);
            }
            this.SetOnlineStatu(bonline);
        }
        /// <summary>
        /// 设置在线状态
@@ -160,23 +170,13 @@
        private void SetOnlineStatu(bool online)
        {
            m_IsOnline = online;
            if (btnOnline == null)
            {
                return;
            }
            if (online == false)
            {
                //初始值:离线
                btnOnline.TextID = R.MyInternationalizationString.uOffLine;
                //初始值:灰色
                btnOnline.TextColor = UserCenterColor.Current.Gray;
                btnName.TextColor = UserCenterColor.Current.TextGrayColor2;
            }
            else
            {
                //在线
                btnOnline.TextID = R.MyInternationalizationString.uOnline;
                //绿色
                btnOnline.TextColor = UserCenterColor.Current.Green;
                btnName.TextColor = UserCenterColor.Current.TextColor1;
            }
        }