From f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 30 十二月 2019 13:32:33 +0800
Subject: [PATCH] 2019-12-30-1

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

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
old mode 100755
new mode 100644
index 777c8a8..6122be0
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -722,6 +722,7 @@
             //new涓�涓柊閫昏緫瀵硅薄锛�
             Common.Logic.CurrentLogic = new Common.Logic();
             Common.Logic.CurrentLogic.IsEnable = 1;//榛樿涓哄紑
+            Common.Logic.CurrentLogic.LogicCustomPushText = Language.StringByID(MyInternationalizationString.defaulttext);
             Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1);
             var addLogicPage = new Shared.Phone.Device.Logic.AddLogicPage();
             UserView.HomePage.Instance.AddChidren(addLogicPage);
@@ -1740,14 +1741,14 @@
         #endregion
 
         #region 鈼� 鑷姩鍖朹_________________________
-
+      
         /// <summary>
-        /// 鑷姩鍖�
+        /// 鑷姩鍖栧姛鑳戒唬鐮佸叆鍙�
         /// </summary>
-        private async void ShowAutotion()
+        private  void ShowAutotion()
         {
-
-            functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
+           // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
+           
             var bjFrameLayout = new FrameLayout
             {
                 Width = Application.GetRealWidth(1080 - 58),
@@ -1758,7 +1759,7 @@
                 Y = Application.GetRealHeight(30),
             };
             functionSceneAutoBodyView.AddChidren(bjFrameLayout);
-            bjFrameLayout.SetCornerWithSameRadius(25, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft);
+            bjFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft);
             var sigBtn = new Button
             {
                 Width = Application.GetMinRealAverage(84),
@@ -1779,7 +1780,7 @@
                 TextID = MyInternationalizationString.logictemplate,
                 Gravity = Gravity.CenterVertical,
                 TextColor = ZigbeeColor.Current.LogicBtnSelectedColor,
-                TextSize=15,
+                TextSize = 15,
             };
             bjFrameLayout.AddChidren(recommendtextBtn);
 
@@ -1804,18 +1805,16 @@
             };
             functionSceneAutoBodyView.AddChidren(scenehorizontalScrol);
 
-            var logicScrolView = new VerticalScrolViewLayout
+            var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout
             {
                 Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30),
-                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                //BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,/
                 X = Application.GetRealWidth(58),
-                //Radius = (uint)Application.GetRealHeight(50),
                 Y = scenehorizontalScrol.Bottom,
             };
             functionSceneAutoBodyView.AddChidren(logicScrolView);
-            logicScrolView.SetCornerWithSameRadius(20, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft);
-
-
+            logicScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
+            bool no = false;
             recommendswitchBtn.MouseUpEventHandler += (sender, e) =>
             {
                 int Yheight = 0;
@@ -1823,6 +1822,7 @@
                 scenehorizontalScrol.RemoveAll();
                 if (recommendswitchBtn.IsSelected)
                 {
+                    no = true;
                     scenehorizontalScrol.Height = Application.GetRealHeight(246);
                     Yheight = 20;
                     for (int i = 1; i < 4; i++)
@@ -1898,21 +1898,39 @@
                 }
                 else
                 {
+                    no = false;
                     scenehorizontalScrol.Height = Application.GetRealHeight(0);
                     Yheight = 0;
                 }
                 logicScrolView.Y = scenehorizontalScrol.Bottom + Yheight;
                 logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight;
-                Automationview(logicScrolView);
+                Automationview(logicScrolView,no);
             };
+            logicScrolView.BeginHeaderRefreshingAction += () =>
+            {
+                //閲嶆柊鍒锋柊logic鍒楄〃
+                Common.Logic.LogicList.Clear();
+                Read(logicScrolView,no);
+                //鍏抽棴鍒锋柊View锛�
+                logicScrolView.EndHeaderRefreshing();
+            };
+           
+            Read(logicScrolView,no);
 
+        }
+        /// <summary>
+        /// 璇诲彇鑷姩鍖栧垪琛ㄦ暟鎹紱
+        /// </summary>
+        /// <param name="logicScrolView"></param>
+        private async void Read(VerticalRefreshLayout logicScrolView,bool no)
+        {
             CommonPage.Loading.Start();
             if (Common.Logic.LogicList.Count == 0)
             {
                 var Idlist = await Logic.Send.GetLogicId(0);
                 if (Idlist.Count != 0)
                 {
-                    var listlogic = await Logic.Send.ReadList(Idlist.Count,0);
+                    var listlogic = await Logic.Send.ReadList(Idlist.Count, 0);
                     //foreach鍙兘闆嗗悎宸茶淇敼,鏋氫妇鎿嶄綔鍙兘涓嶄細鎵ц,鍙兘鍑虹幇宕╂簝(寤鸿for)銆�
                     for (int j = 0; j < listlogic.Count; j++)
                     {
@@ -1926,18 +1944,66 @@
                 }
             }
             //鑷姩鍖�
-            Automationview(logicScrolView);
+            Automationview(logicScrolView,no);
             CommonPage.Loading.Hide();
-            
         }
-
         /// <summary>
-        /// 鑷姩鍖栧垪琛ㄧ晫闈�
+        /// 鍔犺浇鑷姩鍖栧垪琛ㄧ晫闈�
         /// </summary>
         /// <param name="refresview">Refresview.</param>
-        private async void Automationview(VerticalScrolViewLayout refresview)
+        private async void Automationview(VerticalRefreshLayout refresview,bool no)
         {
             refresview.RemoveAll();
+            if (Common.Logic.LogicList.Count == 0&&no==false)
+            {
+                //灏辨槸涓轰簡鏄剧ず寮曞娣诲姞鍥炬爣;
+                refresview.BackgroundColor = 0x00000000;
+                var noFrameLayout = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(434+ 200+32+160),
+                    //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                };
+                refresview.AddChidren(noFrameLayout);
+
+
+                var noIconBtn = new Button
+                {
+                    Y=Application.GetRealHeight(160),
+                    Width = Application.GetMinRealAverage(756),
+                    Height = Application.GetMinRealAverage(434),
+                    UnSelectedImagePath = "Item/NoFunction.png",
+                    X = Application.GetRealWidth(104),
+                };
+                noFrameLayout.AddChidren(noIconBtn);
+
+                var noTextBtn = new Button()
+                {
+                    Y = noIconBtn.Bottom,
+                    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),
+                };
+                noFrameLayout.AddChidren(noTextBtn);
+
+            }
+            else
+            {
+
+                if (Common.Logic.LogicList.Count == 0 && no == true)
+                {
+                    ///鏀瑰彉婊戝姩view鐨勯鑹诧紱
+                    refresview.BackgroundColor = 0x00000000;
+                }
+                else
+                {
+                    refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
+                }
+            }
             foreach (var logic in Common.Logic.LogicList)
             {
 
@@ -1945,7 +2011,7 @@
                 var logicRowlayout = new RowLayout
                 {
                     Height = Application.GetRealHeight(190 + 30),
-                    Width = Application.GetRealWidth(1080),
+                    Width = Application.GetRealWidth(1080-58),
                     LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                     BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                 };
@@ -2022,7 +2088,7 @@
                     var logicCommunalPage = new Logic.LogicCommunalPage();
                     HomePage.Instance.AddChidren(logicCommunalPage);
                     HomePage.Instance.PageIndex += 1;
-                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview); });
+                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview,no); });
 
                 };
 
@@ -2044,7 +2110,7 @@
                         if (e1)
                         {
                             Common.Logic.LogicList.Remove(logic);
-                            Automationview(refresview);
+                            Automationview(refresview,no);
                             Logic.Send.DelLogic(logic.LogicId);
                         }
                     };
@@ -2064,7 +2130,7 @@
 
         }
         /// <summary>
-        /// 鏄剧ず鍥炬爣鐨勯鑹�
+        /// 鏄剧ず鑷姩鍖栬緭鍑哄姛鑳芥ā鍧楀浘鏍囩殑棰滆壊
         /// </summary>
         /// <param name="logic"></param>
         /// <param name="logicRowlayout"></param>
@@ -2463,6 +2529,7 @@
                 }
             }
         }
+
         #endregion
 
         #region 鈼� 鎺у埗鐘舵�乢________________________

--
Gitblit v1.8.0