黄学彪
2020-09-01 dee21bf452a8979d0515d13e534fbb69ed9715dd
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,16 +38,20 @@
            //设置标题信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uGatewayManagement));
            //添加图标
            var btnAdd = new MostRightIconControl(69, 69);
            btnAdd.UnSelectedImagePath = "Item/Add.png";
            topFrameLayout.AddChidren(btnAdd);
            btnAdd.InitControl();
            btnAdd.ButtonClickEvent += (sender, e) =>
            //展示模板不允许编辑
            if (Config.Instance.Home.IsShowTemplate == false)
            {
                var form = new GatewayAdd.NewGateWayMenuSelectForm();
                form.AddForm();
            };
                //添加图标
                var btnAdd = new MostRightIconControl(69, 69);
                btnAdd.UnSelectedImagePath = "Item/Add.png";
                topFrameLayout.AddChidren(btnAdd);
                btnAdd.InitControl();
                btnAdd.ButtonClickEvent += (sender, e) =>
                {
                    var form = new GatewayAdd.NewGateWayMenuSelectForm();
                    form.AddForm();
                };
            }
            //初始化中部控件
            this.InitMiddleFrame();
@@ -101,8 +104,12 @@
            //调整列表控件的高度
            this.listview.AdjustRealHeight(Application.GetRealHeight(23));
            //开启网关在线监测的线程
            this.StartGatewayOnlieCheckThread(listway);
            //如果是展示模板的话,不需要检测
            if (Common.Config.Instance.Home.IsShowTemplate == false)
            {
                //开启网关在线监测的线程
                this.StartGatewayOnlieCheckThread(listway);
            }
        }
        #endregion
@@ -146,36 +153,46 @@
                form.AddForm(gateway);
            };
            //切换
            var btnSwitch = new NormalViewControl(Application.GetRealWidth(184), gatewayRow.Height, false);
            btnSwitch.BackgroundColor = 0xfffb744a;
            btnSwitch.TextAlignment = TextAlignment.Center;
            btnSwitch.TextColor = UserCenterColor.Current.White;
            btnSwitch.TextSize = 12;
            btnSwitch.TextID = R.MyInternationalizationString.uSwitch1;
            if (strWayId == GatewayResourse.AppOldSelectGatewayId)
            //如果是展示模板的话,不能编辑
            if (Common.Config.Instance.Home.IsShowTemplate == true)
            {
                btnSwitch.TextID = R.MyInternationalizationString.uRefresh;
                return;
            }
            gatewayRow.AddRightView(btnSwitch);
            btnSwitch.ButtonClickEvent += (sender, e) =>
            //非虚拟住宅,才有这个功能
            if (Common.Config.Instance.Home.IsVirtually == false)
            {
                //是否切换到{0}网关?
                string msg = string.Format(Language.StringByID(R.MyInternationalizationString.uConfirmWantToSwitchTheGateway), "[" + gatewayRow.btnName.Text + "]");
                //切换
                var btnSwitch = new NormalViewControl(Application.GetRealWidth(184), gatewayRow.Height, false);
                btnSwitch.BackgroundColor = 0xfffb744a;
                btnSwitch.TextAlignment = TextAlignment.Center;
                btnSwitch.TextColor = UserCenterColor.Current.White;
                btnSwitch.TextSize = 12;
                btnSwitch.TextID = R.MyInternationalizationString.uSwitch1;
                if (strWayId == GatewayResourse.AppOldSelectGatewayId)
                {
                    //是否重新刷新{0}网关?
                    msg = string.Format(Language.StringByID(R.MyInternationalizationString.uConfirmWantToRefreshTheGateway), "[" + gatewayRow.btnName.Text + "]");
                    btnSwitch.TextID = R.MyInternationalizationString.uRefresh;
                }
                this.ShowMassage(ShowMsgType.Confirm, msg, () =>
                gatewayRow.AddRightView(btnSwitch);
                btnSwitch.ButtonClickEvent += (sender, e) =>
                {
                    HdlThreadLogic.Current.RunThread(() =>
                    //是否切换到{0}网关?
                    string msg = string.Format(Language.StringByID(R.MyInternationalizationString.uConfirmWantToSwitchTheGateway), "[" + gatewayRow.btnName.Text + "]");
                    if (strWayId == GatewayResourse.AppOldSelectGatewayId)
                    {
                        //执行切换网关操作
                        this.DoSwitchGateway(strWayId);
                        //是否重新刷新{0}网关?
                        msg = string.Format(Language.StringByID(R.MyInternationalizationString.uConfirmWantToRefreshTheGateway), "[" + gatewayRow.btnName.Text + "]");
                    }
                    this.ShowMassage(ShowMsgType.Confirm, msg, () =>
                    {
                        HdlThreadLogic.Current.RunThread(() =>
                        {
                            //执行切换网关操作
                            this.DoSwitchGateway(strWayId);
                        });
                    });
                });
            };
                };
            }
            //定位
            var btnPosition = gatewayRow.AddEditorControl(false);