From 9c16d3614d9b88c637f967518a329f239fcd3aaf Mon Sep 17 00:00:00 2001
From: lss <316519258@qq.com>
Date: 星期五, 12 六月 2020 09:22:04 +0800
Subject: [PATCH] 2020.06.12

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs |  108 +++++++++++++-----------------------------------------
 1 files changed, 26 insertions(+), 82 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
index e0ea8f3..7af7f6f 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
@@ -49,17 +49,9 @@
         /// </summary>
         private ZbGateway realGateway = null;
         /// <summary>
-        /// 杩涘害鏉�
+        /// 杩涘害鏉℃帶浠�
         /// </summary>
-        private FrameLayout btnProgressBar = null;
-        /// <summary>
-        /// 杩涘害鍊兼樉绀烘枃鏈殑鏁翠綋
-        /// </summary>
-        private FrameLayout frameProgress = null;
-        /// <summary>
-        /// 杩涘害鍊肩殑鏄剧ず鏂囨湰
-        /// </summary>
-        private NormalViewControl btnProgressView = null;
+        private ProgressRowBar btnProgressBar = null;
         /// <summary>
         /// 缃戝叧鏄惁鍏佽鍏ョ綉鐨勬爣璇�
         /// </summary>
@@ -96,11 +88,13 @@
             this.ClearBodyFrame();
 
             //鍥剧墖
-            var btnPic = new PicViewControl(878, 478);
-            btnPic.Y = Application.GetRealHeight(251);
-            btnPic.Gravity = Gravity.CenterHorizontal;
-            btnPic.UnSelectedImagePath = "Instruct/DeviceSearch.png";
-            bodyFrameLayout.AddChidren(btnPic);
+            var framePic = new FrameLayout();
+            framePic.Width = this.GetPictrueRealSize(878);
+            framePic.Height = this.GetPictrueRealSize(478);
+            framePic.Y = Application.GetRealHeight(251);
+            framePic.Gravity = Gravity.CenterHorizontal;
+            framePic.BackgroundImagePath = "Instruct/DeviceSearch.png";
+            bodyFrameLayout.AddChidren(framePic);
 
             //姝e湪鎼滅储璁惧锛岃绋嶅�欌��
             var btnSearch = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false);
@@ -111,36 +105,11 @@
             bodyFrameLayout.AddChidren(btnSearch);
 
             //杩涘害鏉�
-            var btnProRow = new FrameLayout();
-            btnProRow.Gravity = Gravity.CenterHorizontal;
-            btnProRow.Y = Application.GetRealHeight(861);
-            btnProRow.Width = Application.GetRealWidth(559);
-            btnProRow.Height = Application.GetRealHeight(29);
-            btnProRow.BackgroundColor = 0xffe6e6e6;
-            btnProRow.Radius = (uint)Application.GetRealHeight(29) / 2;
-            bodyFrameLayout.AddChidren(btnProRow);
-            this.btnProgressBar = new FrameLayout();
-            btnProgressBar.Width = 0;
-            btnProgressBar.Height = btnProRow.Height;
-            btnProgressBar.BackgroundColor = 0xfffb744a;
-            btnProgressBar.Radius = (uint)Application.GetRealHeight(29) / 2;
-            btnProRow.AddChidren(btnProgressBar);
-
-            //杩涘害鍊兼枃鏈�
-            this.frameProgress = new FrameLayout();
-            frameProgress.Width = Application.GetRealWidth(84);
-            frameProgress.Height = Application.GetRealHeight(60);
-            frameProgress.Y = Application.GetRealHeight(772);
-            bodyFrameLayout.AddChidren(frameProgress);
-            frameProgress.X = btnProRow.X + btnProgressBar.Right - frameProgress.Width / 2;
-            var btnProgressPic = new PicViewControl(84, 60);
-            btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png";
-            frameProgress.AddChidren(btnProgressPic);
-            this.btnProgressView = new NormalViewControl(84, 32, true);
-            btnProgressView.TextSize = 10;
-            btnProgressView.TextAlignment = TextAlignment.Center;
-            btnProgressView.Text = "0%";
-            frameProgress.AddChidren(btnProgressView);
+            this.btnProgressBar = new ProgressRowBar(559, 29);
+            btnProgressBar.Gravity = Gravity.CenterHorizontal;
+            btnProgressBar.Y = Application.GetRealHeight(861);
+            bodyFrameLayout.AddChidren(btnProgressBar);
+            btnProgressBar.StartMode1(true);
 
             if (this.realGateway != null)
             {
@@ -150,7 +119,7 @@
                 this.realGateway.GwResDataAction += this.AdjustGatewayResultData;
             }
             //寮�鍚繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉绾跨▼
-            this.StartConcetionAnimeteThread();
+            this.StartConcetionAnimeteThread(framePic);
         }
 
         #endregion
@@ -204,7 +173,7 @@
 
                 //缁欐柊璁惧璁剧疆涓婚敭灞炴��
                 Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject);
-                device.CurrentGateWayId = HdlGatewayLogic.Current.GetGatewayId(this.realGateway);
+                device.CurrentGateWayId = this.realGateway.GwId;
                 //灏咲eviceInfo鐨勫睘鎬ц缃埌涓诲睘鎬т腑
                 Common.LocalDevice.Current.SetDeviceInfoToMain(device, device);
 
@@ -312,7 +281,7 @@
         /// <summary>
         /// 寮�鍚繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉绾跨▼
         /// </summary>
-        private void StartConcetionAnimeteThread()
+        private void StartConcetionAnimeteThread(FrameLayout framePic)
         {
             int iconSize = this.GetPictrueRealSize(23);
 
@@ -320,15 +289,15 @@
             for (int i = 0; i < 9; i++)
             {
                 //X杞�+Index*(鍥炬爣澶у皬+闂磋窛)
-                listPoint.Add(this.GetPictrueRealSize(394) + i * (iconSize + this.GetPictrueRealSize(10)));
+                listPoint.Add(this.GetPictrueRealSize(300) + i * (iconSize + this.GetPictrueRealSize(10)));
             }
 
             var btnRound = new PicViewControl(iconSize, iconSize, false);
             btnRound.Radius = (uint)iconSize / 2;
             btnRound.BackgroundColor = UserCenterColor.Current.ConcetionRoundColor;
             btnRound.X = listPoint[0];
-            btnRound.Y = this.GetPictrueRealSize(475);
-            bodyFrameLayout.AddChidren(btnRound);
+            btnRound.Y = this.GetPictrueRealSize(225);
+            framePic.AddChidren(btnRound);
 
             HdlThreadLogic.Current.RunThread(() =>
             {
@@ -400,7 +369,7 @@
                     return 0;
                 }
                 //缃戝叧鍛婄煡瀹㈡埛绔湁璁惧澹版槑
-                this.SetDeviceProgressValue(1);
+                this.btnProgressBar.SetValue(1, 6);
                 return 2;
             }
             else if (topic == gatewayId + "/Device/DeviceGetActiveEP_Respon")
@@ -417,7 +386,7 @@
                     return 2;
                 }
                 //璁剧疆杩涘害鍊�
-                this.SetDeviceProgressValue(2);
+                this.btnProgressBar.SetValue(2, 6);
                 return 2;
             }
             else if (topic == gatewayId + "/Device/DeviceGetActiveEPSimpleDesc_Respon")
@@ -434,7 +403,7 @@
                     return 2;
                 }
                 //璁剧疆杩涘害鍊�
-                this.SetDeviceProgressValue(3);
+                this.btnProgressBar.SetValue(3, 6);
                 return 2;
             }
             else if (topic == gatewayId + "/Device/DeviceGetDefaultBind_Respon")
@@ -451,7 +420,7 @@
                     return 2;
                 }
                 //璁剧疆杩涘害鍊�
-                this.SetDeviceProgressValue(4);
+                this.btnProgressBar.SetValue(4, 6);
                 return 2;
             }
             else if (topic == gatewayId + "/Device/DeviceAutoBindZBCoord_Respon")
@@ -468,42 +437,17 @@
                     return 2;
                 }
                 //璁剧疆杩涘害鍊�
-                this.SetDeviceProgressValue(5);
+                this.btnProgressBar.SetValue(5, 6);
                 return 2;
             }
             else if (topic == gatewayId + "/DeviceInComingRespon")
             {
                 this.topTimeOut = topMaxTime;
                 //缃戝叧鏈�缁堜笂鎶ヨ妭鐐硅澶囦俊鎭�
-                this.SetDeviceProgressValue(6);
+                this.btnProgressBar.SetValue(6, 6);
                 return 1;
             }
             return 0;
-        }
-
-        /// <summary>
-        /// 璁剧疆璁惧鐨勮繘搴﹀��
-        /// </summary>
-        /// <param name="value"></param>
-        private void SetDeviceProgressValue(decimal value)
-        {
-            Application.RunOnMainThread(() =>
-            {
-                //杩涘害鏉�
-                decimal result = value / 6;
-                int width = (int)(result * Application.GetRealWidth(559));
-                if (btnProgressBar.Width >= width)
-                {
-                    //鏈変簺璁惧浼氫笂鎶ヤ袱娆�,杩欓噷涓嶈兘璁╁畠鐨勮繘搴︽潯寰�鍥炶蛋
-                    return;
-                }
-                btnProgressBar.Width = width;
-
-                //鏂囨湰鏄剧ず
-                btnProgressView.Text = ((int)(result * 100)) + "%";
-                //鏂囨湰鏄剧ず鐨勯偅涓浘鐗囨绉诲姩
-                frameProgress.X = Application.GetRealWidth(262) + btnProgressBar.Right - frameProgress.Width / 2;
-            });
         }
 
         /// <summary>

--
Gitblit v1.8.0