陈嘉乐
2020-09-02 07c647861d549a4c61f615dba9c008c29ad57f43
ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs
@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.GatewayManage
@@ -39,6 +38,9 @@
            //设置标题信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uGatewayManagement));
            //展示模板不允许编辑
            if (Config.Instance.Home.IsShowTemplate == false)
            {
            //添加图标
            var btnAdd = new MostRightIconControl(69, 69);
            btnAdd.UnSelectedImagePath = "Item/Add.png";
@@ -49,6 +51,7 @@
                var form = new GatewayAdd.NewGateWayMenuSelectForm();
                form.AddForm();
            };
            }
            //初始化中部控件
            this.InitMiddleFrame();
@@ -101,8 +104,12 @@
            //调整列表控件的高度
            this.listview.AdjustRealHeight(Application.GetRealHeight(23));
            //如果是展示模板的话,不需要检测
            if (Common.Config.Instance.Home.IsShowTemplate == false)
            {
            //开启网关在线监测的线程
            this.StartGatewayOnlieCheckThread(listway);
            }
        }
        #endregion
@@ -146,6 +153,15 @@
                form.AddForm(gateway);
            };
            //如果是展示模板的话,不能编辑
            if (Common.Config.Instance.Home.IsShowTemplate == true)
            {
                return;
            }
            //非虚拟住宅,才有这个功能
            if (Common.Config.Instance.Home.IsVirtually == false)
            {
            //切换
            var btnSwitch = new NormalViewControl(Application.GetRealWidth(184), gatewayRow.Height, false);
            btnSwitch.BackgroundColor = 0xfffb744a;
@@ -176,6 +192,7 @@
                    });
                });
            };
            }
            //定位
            var btnPosition = gatewayRow.AddEditorControl(false);
@@ -206,7 +223,7 @@
                {
                    HdlThreadLogic.Current.RunThread(() =>
                    {
                        this.DeleteGateway(strWayId, gatewayRow);
                        this.DeleteGateway(strWayId);
                    });
                });
            };
@@ -238,12 +255,12 @@
        /// </summary>
        /// <param name="strWayId"></param>
        /// <param name="row"></param>
        private async void DeleteGateway(string strWayId, GatewayRowControl row)
        private void DeleteGateway(string strWayId)
        {
            //打开进度条
            this.ShowProgressBar();
            //删除云端网关
            bool result = await HdlGatewayLogic.Current.DeleteGateway(strWayId);
            bool result = HdlGatewayLogic.Current.DeleteGateway(strWayId);
            //关闭进度条
            this.CloseProgressBar();
            if (result == false)
@@ -273,9 +290,9 @@
        /// </summary>
        /// <param name="gatewayId"></param>
        /// <param name="online"></param>
        private async void DoSwitchGateway(string gatewayId)
        private void DoSwitchGateway(string gatewayId)
        {
            var result = await HdlGatewayLogic.Current.DoSwitchGateway(gatewayId);
            var result = HdlGatewayLogic.Current.DoSwitchGateway(gatewayId);
            if (result == false)
            {
                return;
@@ -354,7 +371,7 @@
        /// <param name="hadGwOnline">2020.05.25追加:此住宅是否拥有网关在线</param>
        public override void GatewayOnlinePush(ZbGateway gateWay, bool online, bool hadGwOnline)
        {
            Application.RunOnMainThread(() =>
            HdlThreadLogic.Current.RunMain(() =>
            {
                if (this.Parent == null)
                {
@@ -365,7 +382,7 @@
                {
                    this.dicRowContr[gwid].IsOnline = online;
                }
            });
            }, ShowErrorMode.NO);
        }
        #endregion
@@ -376,7 +393,7 @@
        /// 网关新版本检测
        /// </summary>
        /// <param name="listWays"></param>
        private async void CheckGatewayNewVersion(List<ZbGateway> listWays)
        private void CheckGatewayNewVersion(List<ZbGateway> listWays)
        {
            foreach (var way in listWays)
            {
@@ -390,7 +407,7 @@
                    continue;
                }
                //获取最新版本
                var result = await HdlGatewayLogic.Current.GetGatewayAllNewVersion(way, ShowErrorMode.NO);
                var result = HdlGatewayLogic.Current.GetGatewayAllNewVersion(way, ShowErrorMode.NO);
                if (result == null)
                {
                    continue;
@@ -399,7 +416,7 @@
                {
                    //有新版本
                    string gwid = way.GwId;
                    Application.RunOnMainThread(() =>
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        if (this.dicRowContr.ContainsKey(gwid) == true && this.dicRowContr[gwid] != null)
                        {