From 21923381bdac04d1633b168c97accc81f0898d84 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 23 三月 2020 16:45:31 +0800
Subject: [PATCH] 上传版本

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |  130 +++++++++++++++++--------------------------
 1 files changed, 52 insertions(+), 78 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 9bb4cd1..252f21c 100755
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -123,30 +123,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>
@@ -1955,11 +1932,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);
             }
         }
 
@@ -2014,6 +1991,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)
@@ -2021,21 +2002,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();
@@ -2044,31 +2030,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()
+        private void ShowAutotion()
         {
-           // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
-           
+            // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
+
             var bjFrameLayout = new FrameLayout
             {
                 Width = Application.GetRealWidth(1080 - 58),
@@ -2226,25 +2200,25 @@
                 }
                 logicScrolView.Y = scenehorizontalScrol.Bottom + Yheight;
                 logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight;
-                Automationview(logicScrolView,no);
+                Automationview(logicScrolView, no);
             };
             logicScrolView.BeginHeaderRefreshingAction += () =>
             {
                 //閲嶆柊鍒锋柊logic鍒楄〃
                 Common.Logic.LogicList.Clear();
-                Read(logicScrolView,no);
+                Read(logicScrolView, no);
                 //鍏抽棴鍒锋柊View锛�
                 logicScrolView.EndHeaderRefreshing();
-            };
-           
-            Read(logicScrolView,no);
+            };
+
+            Read(logicScrolView, no);
 
         }
         /// <summary>
         /// 璇诲彇鑷姩鍖栧垪琛ㄦ暟鎹紱
         /// </summary>
         /// <param name="logicScrolView"></param>
-        private async void Read(VerticalRefreshLayout logicScrolView,bool no)
+        private async void Read(VerticalRefreshLayout logicScrolView, bool no)
         {
             CommonPage.Loading.Start();
             if (Common.Logic.LogicList.Count == 0)
@@ -2266,23 +2240,23 @@
                 }
             }
             //鑷姩鍖�
-            Automationview(logicScrolView,no);
+            Automationview(logicScrolView, no);
             CommonPage.Loading.Hide();
         }
         /// <summary>
         /// 鍔犺浇鑷姩鍖栧垪琛ㄧ晫闈�
         /// </summary>
         /// <param name="refresview">Refresview.</param>
-        private async void Automationview(VerticalRefreshLayout refresview,bool no)
+        private async void Automationview(VerticalRefreshLayout refresview, bool no)
         {
             refresview.RemoveAll();
-            if (Common.Logic.LogicList.Count == 0&&no==false)
+            if (Common.Logic.LogicList.Count == 0 && no == false)
             {
                 //灏辨槸涓轰簡鏄剧ず寮曞娣诲姞鍥炬爣;
                 refresview.BackgroundColor = 0x00000000;
                 var noFrameLayout = new FrameLayout
                 {
-                    Height = Application.GetRealHeight(434+ 200+32+160),
+                    Height = Application.GetRealHeight(434 + 200 + 32 + 160),
                     //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                 };
                 refresview.AddChidren(noFrameLayout);
@@ -2290,7 +2264,7 @@
 
                 var noIconBtn = new Button
                 {
-                    Y=Application.GetRealHeight(160),
+                    Y = Application.GetRealHeight(160),
                     Width = Application.GetMinRealAverage(756),
                     Height = Application.GetMinRealAverage(434),
                     UnSelectedImagePath = "Item/NoFunction.png",
@@ -2301,14 +2275,14 @@
                 var noTextBtn = new Button()
                 {
                     Y = noIconBtn.Bottom,
-                    Height = Application.GetRealHeight(200)+Application.GetRealHeight(32),
+                    Height = Application.GetRealHeight(200) + Application.GetRealHeight(32),
                     Width = Application.GetRealWidth(700),
                     //Gravity = Gravity.CenterHorizontal,
                     Text = Language.StringByID(MyInternationalizationString.automationaddtext).Replace("{\\r\\n}", "\r\n"),
                     TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
                     TextAlignment = TextAlignment.Center,
                     IsMoreLines = true,
-                    X = Application.GetRealWidth(190-58),
+                    X = Application.GetRealWidth(190 - 58),
                 };
                 noFrameLayout.AddChidren(noTextBtn);
 
@@ -2327,16 +2301,16 @@
                 }
             }
             foreach (var logic in Common.Logic.LogicList)
-            {
-
-                
+            {
+
+
                 var logicRowlayout = new RowLayout
                 {
                     Height = Application.GetRealHeight(190 + 30),
-                    Width = Application.GetRealWidth(1080-58),
-                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
-                   BackgroundColor =ZigbeeColor.Current.LogicBackgroundColor,
-                   
+                    Width = Application.GetRealWidth(1080 - 58),
+                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
+                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+
                 };
                 refresview.AddChidren(logicRowlayout);
 
@@ -2411,9 +2385,9 @@
                     var logicCommunalPage = new Logic.LogicCommunalPage();
                     HomePage.Instance.AddChidren(logicCommunalPage);
                     HomePage.Instance.PageIndex += 1;
-                    logicCommunalPage.Show(() => { 
+                    logicCommunalPage.Show(() => {
                         logicnameBtn.Text = logic.LogicName;
-                        Automationview(refresview,no);
+                        Automationview(refresview, no);
                     });
 
                 };
@@ -2444,7 +2418,7 @@
                 var line = new Button
                 {
                     Y = Application.GetRealHeight(215),
-                    Height = Application.GetRealHeight(5), 
+                    Height = Application.GetRealHeight(5),
                     Width = Application.GetRealWidth(1080 - 58),
                     BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                     X = Application.GetRealWidth(58),
@@ -2924,10 +2898,10 @@
             {
                 commonDeviceList.Add(common);
             }
-        }
-
+        }
+
         #endregion
-
-   
+
+
     }
 }

--
Gitblit v1.8.0