From 944b87b6bcccb095cd73f13f4410fb20faf48f74 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期三, 25 十二月 2019 11:21:06 +0800
Subject: [PATCH] 2019.12.25

---
 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs |  131 +++++++++++++++++++++----------------------
 1 files changed, 65 insertions(+), 66 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs
index 4f3dfb9..22baf6c 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs
+++ b/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

--
Gitblit v1.8.0