From b304a3c78df10b6e9b867e677d3e4719f1d4a7aa Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期二, 24 三月 2020 09:12:15 +0800
Subject: [PATCH] 2020-03-23-3

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |  125 ++++++++++++++++++-----------------------
 1 files changed, 54 insertions(+), 71 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index e4a7c12..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,9 +2317,16 @@
                     refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
                 }
             }
+
             foreach (var logic in Common.Logic.LogicList)
             {
-
+                var fLayout = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(190 + 30),
+                    Width = Application.GetRealWidth(1080 - 58),
+                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+                };
+                refresview.AddChidren(fLayout);
 
                 var logicRowlayout = new RowLayout
                 {
@@ -2347,9 +2337,7 @@
                     SubViewWidth = Application.GetRealWidth(184),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛�
 
                 };
-                refresview.AddChidren(logicRowlayout);
-
-
+                fLayout.AddChidren(logicRowlayout);
 
                 var logicnameBtn = new Button
                 {
@@ -2364,11 +2352,10 @@
                 };
                 logicRowlayout.AddChidren(logicnameBtn);
 
-
                 var logicswitchBtn = new Button
                 {
-                    Width = Application.GetRealWidth(104),
-                    Height = Application.GetRealHeight(63),
+                    Width = Application.GetMinRealAverage(104),
+                    Height = Application.GetMinRealAverage(63),
                     UnSelectedImagePath = "ZigeeLogic/logicclose.png",
                     SelectedImagePath = "ZigeeLogic/logicopen.png",
                     X = logicRowlayout.Width - Application.GetRealWidth(104 + 58),
@@ -2376,8 +2363,6 @@
 
                 };
                 logicRowlayout.AddChidren(logicswitchBtn);
-
-
 
                 logicswitchBtn.MouseUpEventHandler += (sender1, e1) =>
                 {
@@ -2425,7 +2410,6 @@
 
                 };
 
-
                 ///鍒犻櫎
                 var del = new Button
                 {
@@ -2447,18 +2431,17 @@
                             Logic.Send.DelLogic(logic.LogicId);
                         }
                     };
-                    alert.Show();
 
                 };
                 var line = new Button
                 {
-                    Y = Application.GetRealHeight(215),
-                    Height = Application.GetRealHeight(5),
+                    Y = fLayout.Height-1,
+                    Height =1,
+                    X = Application.GetRealWidth(58),
                     Width = Application.GetRealWidth(1080 - 58),
                     BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-                    X = Application.GetRealWidth(58),
                 };
-                logicRowlayout.AddChidren(line);
+                fLayout.AddChidren(line);
             }
 
         }
@@ -2522,7 +2505,7 @@
                     Height = Application.GetMinRealAverage(82),
                     X = Application.GetRealWidth(58) + Application.GetRealWidth(12 + (12 + 82 + 45 + 12) * i),
                     Y = Application.GetRealHeight(58 + 30 + 30),
-                    Radius = (uint)Application.GetRealHeight(41),
+                    Radius = (uint)Application.GetMinRealAverage(41),
                     BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                 };
                 logicRowlayout.AddChidren(typebjBtn);
@@ -2687,10 +2670,10 @@
             {
                 commonDeviceList.Add(common);
             }
-        }
-
+        }
+
         #endregion
-
-   
+
+
     }
 }

--
Gitblit v1.8.0