gxc
2019-12-25 944b87b6bcccb095cd73f13f4410fb20faf48f74
ZigbeeApp/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs
@@ -48,54 +48,54 @@
        /// <param name="i_virtualFirmware">虚拟设备的固件信息</param>
        /// <param name="i_coordinatorFirmware">协调器新版本的固件信息</param>
        /// <param name="i_gatewayFirmware">网关新版本的固件信息</param>
        /// <param name="i_listVode">虚拟驱动</param>
        public void ShowForm(ZbGateway i_zbGateway, FirmwareVersionInfo i_virtualFirmware, FirmwareVersionInfo i_coordinatorFirmware,
            FirmwareVersionInfo i_gatewayFirmware, List<ZbGatewayData.DriveCodeObj> i_listVode)
        {
        /// <param name="i_listVode">虚拟驱动</param>
        public void ShowForm(ZbGateway i_zbGateway, FirmwareVersionInfo i_virtualFirmware, FirmwareVersionInfo i_coordinatorFirmware,
            FirmwareVersionInfo i_gatewayFirmware, List<ZbGatewayData.DriveCodeObj> i_listVode)
        {
            this.upDatezbGateway = i_zbGateway;
            this.virtualFirmware = i_virtualFirmware;
            this.coordinatorFirmware = i_coordinatorFirmware;
            this.gatewayFirmware = i_gatewayFirmware;
            this.listVode = i_listVode;
            //初始化中部信息
            this.InitMiddleFrame();
        }
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
            this.listVode = i_listVode;
            //初始化中部信息
            this.InitMiddleFrame();
        }
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            var frameBack = new FrameLayout();
            frameBack.Width = Application.GetRealWidth(674);
            frameBack.Height = Application.GetRealHeight(386);
            frameBack.BackgroundColor = UserCenterColor.Current.White;
            frameBack.Gravity = Gravity.CenterHorizontal;
            frameBack.Y = Application.GetRealHeight(683);
            frameBack.Radius = 6;
            bodyFrameLayout.AddChidren(frameBack);
            //进度显示文本
            var btnText = new NormalViewControl(frameBack.Width, Application.GetRealHeight(58), false);
            btnText.Y = Application.GetRealHeight(248);
            btnText.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnText.TextAlignment = TextAlignment.Center;
            //btnText.Text = "升级中";
            var frameBack = new FrameLayout();
            frameBack.Width = Application.GetRealWidth(674);
            frameBack.Height = Application.GetRealHeight(386);
            frameBack.BackgroundColor = UserCenterColor.Current.White;
            frameBack.Gravity = Gravity.CenterHorizontal;
            frameBack.Y = Application.GetRealHeight(683);
            frameBack.Radius = 6;
            bodyFrameLayout.AddChidren(frameBack);
            //进度显示文本
            var btnText = new NormalViewControl(frameBack.Width, Application.GetRealHeight(58), false);
            btnText.Y = Application.GetRealHeight(248);
            btnText.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnText.TextAlignment = TextAlignment.Center;
            //btnText.Text = "升级中";
            frameBack.AddChidren(btnText);
            //进度条
            var btnProRow = new FrameLayout();
            btnProRow.Gravity = Gravity.CenterHorizontal;
            btnProRow.Y = Application.GetRealHeight(161);
            btnProRow.Width = Application.GetRealWidth(559);
            btnProRow.Height = Application.GetRealHeight(29);
            var btnProRow = new FrameLayout();
            btnProRow.Gravity = Gravity.CenterHorizontal;
            btnProRow.Y = Application.GetRealHeight(161);
            btnProRow.Width = Application.GetRealWidth(559);
            btnProRow.Height = Application.GetRealHeight(29);
            btnProRow.BackgroundColor = 0xfff5f5f5;
            btnProRow.Radius = (uint)Application.GetRealHeight(29) / 2;
            frameBack.AddChidren(btnProRow);
            var btnProgressBar = new FrameLayout();
            btnProgressBar.Width = 0;
            btnProgressBar.Height = btnProRow.Height;
            frameBack.AddChidren(btnProRow);
            var btnProgressBar = new FrameLayout();
            btnProgressBar.Width = 0;
            btnProgressBar.Height = btnProRow.Height;
            btnProgressBar.Radius = btnProRow.Radius;
            btnProgressBar.BackgroundColor = 0xfffb744a;
            btnProgressBar.Radius = (uint)Application.GetRealHeight(29) / 2;
@@ -141,30 +141,29 @@
            //更新状态变化的事件
            updateLogic.UpdateStatuChangedEvent += (div, msg) =>
            {
                if (div == -1)
                HdlThreadLogic.Current.RunMain(() =>
                {
                    //异常
                    this.ShowMassage(ShowMsgType.Tip, msg);
                    this.CloseForm();
                }
                else if (div == 0)
                {
                    //一般信息
                    btnText.Text = msg;
                }
                else if (div == 1)
                {
                    //升级完成
                    this.ShowMassage(ShowMsgType.Tip, msg);
                    //调用回调函数
                    this.FinishUpdateEvent?.Invoke();
                    this.CloseForm();
                }
                else if (div == 2)
                {
                    //主动终止升级
                    this.CloseForm();
                }
                    if (div == -1)
                    {
                        //异常
                        this.ShowMassage(ShowMsgType.Tip, msg);
                        this.CloseForm();
                    }
                    else if (div == 0)
                    {
                        //一般信息
                        btnText.Text = msg;
                    }
                    else if (div == 1)
                    {
                        //升级完成
                        btnText.Text = msg;
                        this.ShowMassage(ShowMsgType.Tip, msg);
                        //调用回调函数
                        this.FinishUpdateEvent?.Invoke();
                        this.CloseForm();
                    }
                });
            };
            //进度值改变事件
            updateLogic.ProgressEvent += (value) =>
@@ -172,12 +171,12 @@
                Application.RunOnMainThread(() =>
                {
                    //进度条
                    decimal result = value / 100;
                    int width = (int)(result * ProRowWidth);
                    int width = (int)(value * ProRowWidth);
                    btnProgressBar.Width = width;
                    //文本显示
                    btnProgressView.Text = value + "%";
                    int persent = (int)(value * 100);
                    btnProgressView.Text = persent + "%";
                    //文本显示的那个图片框移动
                    frameProgress.X = ControlCommonResourse.XXLeft + btnProgressBar.Right - frameProgress.Width / 2;
                });
@@ -194,7 +193,7 @@
        /// <summary>
        /// 画面关闭
        /// </summary>
        public override void CloseForm()
        public override void CloseFormBefore()
        {
            //安卓可以点击系统的返回键
            UserView.HomePage.Instance.ScrollEnabled = true;
@@ -211,7 +210,7 @@
            }
            this.FinishUpdateEvent = null;
            base.CloseForm();
            base.CloseFormBefore();
        }
        #endregion