From bba578c2f0acf2eca747edcb69426771e0cadd32 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 23 三月 2020 18:20:50 +0800
Subject: [PATCH] 2020-03-23-3

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |   96 +++++++++++++++++++----------------------------
 1 files changed, 39 insertions(+), 57 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 32de9d4..a770748 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -126,30 +126,7 @@
         #endregion
 
         #region 鈼� 鎺ュ彛____________________________
-        /// <summary>
-        /// 璇ユ帴鍙e皢寮冪敤 鏀圭敤DeviceInfoChange()
-        /// </summary>
-        /// <param name="common">Common.</param>
-        public void Changed(CommonDevice common)
-        {
 
-        }
-        /// <summary>
-        /// Changeds the IL ogic status.
-        /// </summary>
-        /// <param name="logic">Logic.</param>
-        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
-        {
-
-        }
-        /// <summary>
-        /// Changeds the IS cene status.
-        /// </summary>
-        /// <param name="scene">Scene.</param>
-        public void ChangedISceneStatus(Scene scene)
-        {
-
-        }
         /// <summary>
         /// 璁惧鐘舵�佹洿鏂版帴鍙�
         /// <para>type锛氬鏋滀负 DeviceInComingRespon:璁惧鏂颁笂鎶�</para>
@@ -1958,11 +1935,11 @@
                 functionSceneBodyView.AddChidren(sceneScrolView);
                 foreach (var scene in sceneList)
                 {
-                    var sceneView = new SceneCategoryView(0, 0);
+                    var sceneView = new SceneCategoryView();
                     sceneScrolView.AddChidren(sceneView);
-                    sceneView.Init(scene, room);
-                    GetDelayScene(sceneScrolView);
-                }
+                    sceneView.InitControl(scene, room);
+                }
+                GetDelayScene(sceneScrolView);
             }
         }
 
@@ -2017,6 +1994,10 @@
             for (int i = 0; scrolViewLayout != null && i < scrolViewLayout.ChildrenCount; i++)
             {
                 var sceneView = scrolViewLayout.GetChildren(i) as SceneCategoryView;
+                if (sceneView == null)
+                {
+                    continue;
+                }
                 foreach (var delayScenesListResponseInfo in delayList)
                 {
                     if (delayScenesListResponseInfo.ScenesId == sceneView.scene.Id)
@@ -2024,21 +2005,26 @@
                         sceneView.scene.RemainTime = delayScenesListResponseInfo.RemainTime;
                         var remainTime = delayScenesListResponseInfo.RemainTime;
                         if (remainTime > 0)
-                        {
+                        {
+                            //寮�鍚唴閮ㄥ欢鏃舵椂闂寸嚎绋�(鏃ㄥ湪鍏ㄩ儴鍦版柟鐨勫悓涓�鍦烘櫙鏃堕棿鍚屾)
+                            HdlSceneLogic.Current.StartDelayTimeThread(sceneView.scene);
                             new System.Threading.Thread(() =>
                             {
-                                while (remainTime-- > 0)
+                                while (remainTime > 0 && this.Parent != null)
                                 {
                                     System.Threading.Thread.Sleep(1000);
                                     Application.RunOnMainThread(() =>
                                     {
                                         sceneView.SetTimeText(CommonFormResouce.GetTimeString(remainTime));
                                     });
+                                    remainTime--;
                                 }
                                 Application.RunOnMainThread(() =>
                                 {
-                                    sceneView.scene.RemainTime = 0;
-                                    sceneView.SetTimeImage();
+                                    if (this.Parent != null)
+                                    {
+                                        sceneView.SetTimeImage();
+                                    }
                                 });
                             })
                             { IsBackground = true }.Start();
@@ -2047,32 +2033,19 @@
                     }
                 }
             }
-        }
-
-        /// <summary>
-        /// GetExecScene
-        /// </summary>
-        /// <param name="scrolViewLayout"></param>
-        private void GetExecScene(VerticalScrolViewLayout scrolViewLayout)
-        {
-            new System.Threading.Thread(() =>
-            {
-
-            })
-            { IsBackground = true }.Start();
-        }
+        }
+
         #endregion
-
+
         #region 鈼� 鑷姩鍖朹_________________________
-
+
         /// <summary>
         /// 鑷姩鍖栧姛鑳戒唬鐮佸叆鍙�
         /// </summary>
         private void ShowAutotion()
-        {
-            // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
-            #region   ---鎺ㄨ崘妯℃澘鐨勭粍浠�
-            //鎺ㄨ崘妯℃澘鑳屾櫙鎺т欢
+        {
+            // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
+
             var bjFrameLayout = new FrameLayout
             {
                 Width = Application.GetRealWidth(1080 - 58),
@@ -2244,6 +2217,16 @@
                 //鍏抽棴鍒锋柊View锛�
                 logicScrolView.EndHeaderRefreshing();
             };
+            logicScrolView.BeginHeaderRefreshingAction += () =>
+            {
+                //閲嶆柊鍒锋柊logic鍒楄〃
+                Common.Logic.LogicList.Clear();
+                Read(logicScrolView, no);
+                //鍏抽棴鍒锋柊View锛�
+                logicScrolView.EndHeaderRefreshing();
+            };
+
+            Read(logicScrolView, no);
 
             Read(logicScrolView, no);
 
@@ -2334,7 +2317,7 @@
                     refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
                 }
             }
-          
+
             foreach (var logic in Common.Logic.LogicList)
             {
                 var fLayout = new FrameLayout
@@ -2448,7 +2431,6 @@
                             Logic.Send.DelLogic(logic.LogicId);
                         }
                     };
-                    alert.Show();
 
                 };
                 var line = new Button
@@ -2688,10 +2670,10 @@
             {
                 commonDeviceList.Add(common);
             }
-        }
-
+        }
+
         #endregion
-
-   
+
+
     }
 }

--
Gitblit v1.8.0