From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceHistoryFirmwareVersionForm.cs |  128 ++++++++++++++++++++----------------------
 1 files changed, 62 insertions(+), 66 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceHistoryFirmwareVersionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceHistoryFirmwareVersionForm.cs
index a7619d7..a2aec74 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceHistoryFirmwareVersionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceHistoryFirmwareVersionForm.cs
@@ -8,77 +8,81 @@
     /// <summary>
     /// 璁惧鐨勫巻鍙茬増鏈�
     /// </summary>
-    public class DeviceHistoryFirmwareVersionForm : UserCenterCommonForm
+    public class DeviceHistoryFirmwareVersionForm : EditorCommonForm
     {
-        /// <summary>
-        /// 鍗囩骇鐨勮澶�
-        /// </summary>
+        /// <summary>
+        /// 鍗囩骇鐨勮澶�
+        /// </summary>
         private List<CommonDevice> listUpdateDevice = null;
         /// <summary>
         /// 鍒楄〃鎺т欢
         /// </summary>
-        private VerticalScrolViewLayout listView = null;
+        private VerticalListControl listView = null;
         /// <summary>
-        /// 鐣岄潰鍏抽棴鐨凙ction
+        /// 鍥轰欢閫夋嫨鐨勪簨浠�
         /// </summary>
-        public Action<FirmwareVersionInfo> FormCloseAction = null;
+        public Action<FirmwareVersionInfo> SelectFirmwareInfoEvent = null;
 
         /// <summary>
         /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
         /// </summary>
-        /// <param name="i_listdevice">璁惧</param>
-        public void ShowForm(List<CommonDevice> i_listdevice)
-        {
-            this.listUpdateDevice = i_listdevice;
-
-            //璁剧疆鏍囬淇℃伅
-            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uHistoryVersion));
-
-            //鍒濆鍖栦腑閮ㄦ帶浠�
-            this.InitMiddleFrame();
-        }
-
-        /// <summary>
-        /// 鍒濆鍖栦腑閮ㄦ帶浠�
-        /// </summary>
-        private void InitMiddleFrame()
+        /// <param name="deviceMac">璁惧Mac鍦板潃</param>
+        public void ShowForm(string deviceMac)
         {
-            listView = new VerticalScrolViewLayout();
+            this.listUpdateDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac);
+
+            //璁剧疆鏍囬淇℃伅
+            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uHistoryVersion));
+
+            //鍒濆鍖栦腑閮ㄦ帶浠�
+            this.InitMiddleFrame();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄦ帶浠�
+        /// </summary>
+        private void InitMiddleFrame()
+        {
+            //娓呯┖bodyFrame
+            this.ClearBodyFrame();
+
+            listView = new VerticalListControl(12);
             listView.Height = bodyFrameLayout.Height;
+            listView.BackgroundColor = UserCenterColor.Current.White;
             bodyFrameLayout.AddChidren(listView);
 
-            //鎷ユ湁200绔彛杩欎釜涓滆タ鐨勬椂鍊欙紝鎵嶄細鏄剧ず
-            var oTADevice = Common.LocalDevice.Current.GetOTADevice(listUpdateDevice[0].DeviceAddr);
+            //鎷ユ湁200绔彛杩欎釜涓滆タ鐨勬椂鍊欙紝鎵嶄細鏄剧ず
+            var oTADevice = HdlDeviceCommonLogic.Current.GetOTADevice(listUpdateDevice[0].DeviceAddr);
             if (oTADevice == null || oTADevice.ImgVersion == -1)
             {
                 return;
             }
 
             //鑾峰彇鍘嗗彶鐗堟湰
-            var listData = FirmwareUpdateLogic.GetFirmwareVersionListInfo(FirmwareLevelType.ZigbeeDevice,
+            var listData = HdlFirmwareUpdateLogic.Current.GetFirmwareVersionListInfo(FirmwareLevelType.A璁惧,
                 oTADevice.HwVersion.ToString(),
                 oTADevice.ImgTypeId.ToString());
 
-            var btnTemp = new ButtonCommon();
-            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnTemp, listUpdateDevice);
+            string unSelectPic = string.Empty;
+            string selectPic = string.Empty;
+            HdlDeviceCommonLogic.Current.GetDeviceObjectIcon(listUpdateDevice, ref unSelectPic, ref selectPic);
 
-            new System.Threading.Thread(() =>
+            HdlThreadLogic.Current.RunThread(() =>
             {
                 string ImagType = oTADevice.ImgTypeId.ToString();
-                foreach (var data in listData)
+                HdlThreadLogic.Current.RunMain(() =>
                 {
-                    if (data.ImagType == ImagType && oTADevice.ImgVersion == data.FirmwareVersion)
+                    foreach (var data in listData)
                     {
-                        //鍚屼竴涓笢瑗匡紝涓嶆樉绀哄嚭鏉�
-                        continue;
+                        if (data.ImagType == ImagType && oTADevice.ImgVersion == data.FirmwareVersion)
+                        {
+                            //鍚屼竴涓笢瑗匡紝涓嶆樉绀哄嚭鏉�
+                            continue;
+                        }
+                        this.AddRowlayout(data, unSelectPic, selectPic);
                     }
-                    Application.RunOnMainThread(() =>
-                    {
-                        this.AddRowlayout(data, btnTemp.UnSelectedImagePath, btnTemp.SelectedImagePath);
-                    });
-                }
-            })
-            { IsBackground = true }.Start();
+                });
+            });
         }
 
         /// <summary>
@@ -87,42 +91,34 @@
         /// <param name="info"></param>
         /// <param name="unSelPath"></param>
         /// <param name="selPath"></param>
-        private void AddRowlayout(FirmwareVersionInfo info, string unSelPath,string selPath)
+        private void AddRowlayout(FirmwareVersionInfo info, string unSelPath, string selPath)
         {
-            var rowlayout = new StatuRowLayout(listView);
-
+            var rowlayout = new FrameRowControl(listView.rowSpace / 2);
+            listView.AddChidren(rowlayout);
             //鍥炬爣
-            var btnIcon = new RowLeftIconView();
+            var btnIcon = rowlayout.AddLeftIcon();
             btnIcon.UnSelectedImagePath = unSelPath;
-            btnIcon.SelectedImagePath = selPath;
-            rowlayout.AddChidren(btnIcon);
-
             //鎸囧畾鐨勮澶�
-            var btnDevice = new RowTopBlackView();
-            btnDevice.BackgroundColor = UserCenterColor.Current.Transparent;
-            btnDevice.Text = info.ShowName;
-            rowlayout.AddChidren(btnDevice);
-
-            //鍥轰欢淇℃伅
-            var btnVersion = new RowBottomBlackView();
-            btnVersion.Text = Common.LocalDevice.Current.AppendVersion(info.FirmwareVersion);
-            rowlayout.AddChidren(btnVersion);
-
+            rowlayout.AddTopView(info.ShowName, 800);
             //鍚戝彸鐨勫浘鏍�
-            rowlayout.AddRightIconControl();
+            rowlayout.AddRightArrow();
+            //鍥轰欢淇℃伅
+            string firmwareText = HdlDeviceCommonLogic.Current.AppendVersion(info.FirmwareVersion);
+            firmwareText += "        " + HdlCommonLogic.Current.ConvertUtcTimeToLocalTime(info.CreatedOnUtc).ToString("yyyy/MM/dd HH:mm:ss");
+            rowlayout.AddBottomView(firmwareText, 800);
+            //搴曠嚎
+            rowlayout.AddBottomLine();
 
-            rowlayout.MouseUpEvent += (sender, e) =>
+            rowlayout.ButtonClickEvent += (sender, e) =>
             {
-                string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.listUpdateDevice[0]);
-                if (FirmwareUpdateResourse.dicDeviceUpdateList.ContainsKey(mainKeys) == true)
+                string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(this.listUpdateDevice[0]);
+                if (HdlFirmwareUpdateResourse.dicUpdateList.ContainsKey(mainKeys) == true)
                 {
                     this.CloseForm();
                     return;
                 }
-                if (FormCloseAction != null)
-                {
-                    FormCloseAction(info);
-                }
+                SelectFirmwareInfoEvent?.Invoke(info);
+                SelectFirmwareInfoEvent = null;
                 this.CloseForm();
             };
         }

--
Gitblit v1.8.0