From 40f46f32cb00f4304a691d4f027a76a13a9ebb6d Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期一, 16 十二月 2019 15:11:36 +0800
Subject: [PATCH] 2019.12.16

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |   91 +++++++++++++++++++++++++--------------------
 1 files changed, 50 insertions(+), 41 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index bff8cca..a9211dd 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -345,7 +345,20 @@
                                     {
                                         var dimmableLight = deviceUI.CommonDevice as DimmableLight;
                                         dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
-                                        //璁板綍銆佹洿鏂扮姸鎬�
+                                        if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
+                                        {
+                                            continue;
+                                        }
+                                        dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData;
+                                        var row = rowLayout.GetChildren(0) as CategoryFunctionRow;
+                                        row.SetStatu(dimmableLight.OnOffStatus == 1);
+                                        row.SetStatuText(deviceUI.GetDeviceStatu());
+                                        dimmableLight.LastDateTime = DateTime.Now;
+                                    }
+                                    if (common.DeviceStatusReport.CluterID == 8)
+                                    {
+                                        var dimmableLight = deviceUI.CommonDevice as DimmableLight;
+                                        dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
                                         if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0)
                                         {
                                             continue;
@@ -876,7 +889,7 @@
                         {
                             var alert = new CustomAlert();
                             AddChidren(alert);
-                            alert.Show(Language.StringByID(R.MyInternationalizationString.ConfirmDelete));
+                            alert.Show(Language.StringByID(R.MyInternationalizationString.DeleteFunction));
                             alert.ResultEventHandler += (e2) =>
                             {
                                 if (e2)
@@ -1299,7 +1312,7 @@
                                 Tag = deviceUI,
                                 Radius = 0
                             };
-                            var delBtn = new Device.CommonForm.RowLayoutDeleteButton()
+                            var delBtn = new CommonForm.RowLayoutDeleteButton()
                             {
                                 Tag = deviceUI,
                                 Radius = 0
@@ -1675,57 +1688,53 @@
         /// GetDelayScene
         /// </summary>
         /// <param name="scrolViewLayout"></param>
-        private void GetDelayScene(VerticalScrolViewLayout scrolViewLayout)
+        private async void GetDelayScene(VerticalScrolViewLayout scrolViewLayout)
         {
-            new System.Threading.Thread(async () =>
+            var catDelaySceneResponseAllData = await Scene.CatDelaySceneAsync();
+            if (catDelaySceneResponseAllData == null)
             {
-                var catDelaySceneResponseAllData = await Scene.CatDelaySceneAsync();
-                if (catDelaySceneResponseAllData == null)
-                {
-                    return;
-                }
-                var catDelaySceneResponseData = catDelaySceneResponseAllData.catDelaySceneResponseData;
-                if (catDelaySceneResponseData == null || catDelaySceneResponseData.DelayScenesList.Count == 0)
-                {
-                    return;
-                }
-                var delayList = catDelaySceneResponseData.DelayScenesList;
+                return;
+            }
+            var catDelaySceneResponseData = catDelaySceneResponseAllData.catDelaySceneResponseData;
+            if (catDelaySceneResponseData == null || catDelaySceneResponseData.DelayScenesList.Count == 0)
+            {
+                return;
+            }
+            var delayList = catDelaySceneResponseData.DelayScenesList;
 
-                Application.RunOnMainThread(() =>
+            for (int i = 0; scrolViewLayout != null && i < scrolViewLayout.ChildrenCount; i++)
+            {
+                var sceneView = scrolViewLayout.GetChildren(i) as SceneCategoryView;
+                foreach (var delayScenesListResponseInfo in delayList)
                 {
-                    for (int i = 0; scrolViewLayout != null && i < scrolViewLayout.ChildrenCount; i++)
+                    if (delayScenesListResponseInfo.ScenesId == sceneView.scene.Id)
                     {
-                        var sceneView = scrolViewLayout.GetChildren(i) as SceneCategoryView;
-                        foreach (var delayScenesListResponseInfo in delayList)
+                        sceneView.scene.RemainTime = delayScenesListResponseInfo.RemainTime;
+                        var remainTime= delayScenesListResponseInfo.RemainTime;
+                        if (remainTime > 0)
                         {
-                            if (delayScenesListResponseInfo.ScenesId == sceneView.scene.Id)
+                            new System.Threading.Thread(() =>
                             {
-                                sceneView.scene.RemainTime = delayScenesListResponseInfo.RemainTime;
-                                new System.Threading.Thread(() =>
+                                while (remainTime-- > 0)
                                 {
-                                    while (sceneView.scene.RemainTime > 0)
-                                    {
-                                        System.Threading.Thread.Sleep(1000);
-                                        Application.RunOnMainThread(() =>
-                                        {
-                                            sceneView.SetTimeText(CommonFormResouce.GetTimeString(sceneView.scene.RemainTime));
-                                        });
-                                        sceneView.scene.RemainTime -= 1;
-                                    }
+                                    System.Threading.Thread.Sleep(1000);
                                     Application.RunOnMainThread(() =>
                                     {
-                                        sceneView.SetTimeImage();
+                                        sceneView.SetTimeText(CommonFormResouce.GetTimeString(remainTime));
                                     });
-                                })
-                                { IsBackground = true }.Start();
-
-                                break;
-                            }
+                                }
+                                Application.RunOnMainThread(() =>
+                                {
+                                    sceneView.scene.RemainTime = 0;
+                                    sceneView.SetTimeImage();
+                                });
+                            })
+                            { IsBackground = true }.Start();
                         }
+                        break;
                     }
-                });
-            })
-            { IsBackground = true }.Start();
+                }
+            }
         }
 
         /// <summary>

--
Gitblit v1.8.0