陈嘉乐
2020-07-10 48ba446936b51fffafa7c3600c0dadc6ac0e8c20
ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayUploadAndDownLoadForm.cs
@@ -69,7 +69,11 @@
            var btnSwicth = frameAuto.AddMostRightSwitchIcon();
            btnSwicth.ButtonClickEvent += (sender, e) =>
            {
                btnSwicth.IsSelected = !btnSwicth.IsSelected;
                //设置状态
                if (HdlGatewayLogic.Current.SetGatewayAutoBackupStatu(this.realGateway, !btnSwicth.IsSelected) == true)
                {
                    btnSwicth.IsSelected = !btnSwicth.IsSelected;
                }
            };
            //上传数据至云端
@@ -88,17 +92,16 @@
                    return;
                }
                //生成一个弹窗画面
                var dialogForm = new DialogInputForm();
                dialogForm.AddForm(DialogFrameMode.OnlyInput);
                var dialogForm = new DialogInputControl();
                //上传数据
                dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uUploadData));
                //请输入备注名称
                dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup));
                //请输入备份名称
                dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName));
                //按下确认按钮
                dialogForm.ComfirmClickEvent += ((textValue) =>
                {
                    //画面关闭
                    dialogForm.CloseForm();
                    dialogForm.CloseDialog();
                    HdlThreadLogic.Current.RunThread(() =>
                    {
                        //上传备份
@@ -114,16 +117,58 @@
            frameDown.AddRightArrow();
            frameDown.ButtonClickEvent += (sender, e) =>
            {
                if (this.realGateway == null)
                {
                    //错误:网关对象丢失
                    string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
                    this.ShowMassage(ShowMsgType.Error, msg);
                    return;
                }
                var form = new GatewayBackUpListForm();
                form.AddForm(this.realGateway);
            };
            //调整真实高度
            listView.AdjustRealHeight(Application.GetRealHeight(23));
            HdlThreadLogic.Current.RunThread(() =>
            {
                //获取网关数据
                this.GetGatewayData(btnSwicth);
            });
        }
        #endregion
        #region ■ 一般方法___________________________
        #region ■ 获取数据___________________________
        /// <summary>
        /// 获取网关数据
        /// </summary>
        /// <param name="btnSwitch"></param>
        private void GetGatewayData(MostRightIconControl btnSwitch)
        {
            //打开进度条
            this.ShowProgressBar();
            //获取网关自动设置状态
            var statu = HdlGatewayLogic.Current.GetGatewayAutoBackupStatu(realGateway);
            if (statu == -1)
            {
                //关闭进度条
                this.CloseProgressBar(ShowReLoadMode.YES);
                return;
            }
            if (statu == 1)
            {
                HdlThreadLogic.Current.RunMain(() =>
                {
                    btnSwitch.IsSelected = true;
                });
            }
            //关闭进度条
            this.CloseProgressBar();
        }
        #endregion
    }