From f6e34a69f1d1e0b0b3a6252fe20acddca7fe56e5 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期二, 17 三月 2020 15:43:44 +0800
Subject: [PATCH] 2020-03-17-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs |  143 ++++++++++++++++++++++++++---------------------
 1 files changed, 79 insertions(+), 64 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
old mode 100644
new mode 100755
index 8870208..642f04f
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
@@ -10,60 +10,17 @@
 
         public LockLogicList()
         {
-            Tag = "LockLogicList";
+            Tag = "Logic";
         }
-        VerticalScrolViewLayout middle;
-        public async void Show()
+        VerticalRefreshLayout middle;
+        public void Show()
         {
 
-            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
-            var topRowLayout = new RowLayout
-            {
-                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
-                Height = Application.GetRealHeight(184),
-                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
-            };
-            this.AddChidren(topRowLayout);
-
-            var titleName = new Button
-            {
-                TextSize = 16,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(176),
-                Width = Application.GetRealWidth(400),
-                Height = Application.GetRealHeight(69),
-                Y = Application.GetRealHeight(92),
-                TextID = MyInternationalizationString.linkageevent,
-            };
-            topRowLayout.AddChidren(titleName);
-
-            var clickBtn = new Button
-            {
-                Width = Application.GetRealWidth(81 + 51),
-                Height = Application.GetRealHeight(58 + 40),
-                Y = Application.GetRealHeight(98 - 40),
-            };
-            topRowLayout.AddChidren(clickBtn);
-            clickBtn.MouseDownEventHandler += (sender, e) =>
-            {
-                RemoveFromParent();
-            };
-
-            var back = new Button
-            {
-                Width = Application.GetRealWidth(30),
-                Height = Application.GetRealHeight(51),
-                X = Application.GetRealWidth(81),
-                Y = Application.GetRealHeight(98),
-                //Gravity = Gravity.CenterVertical;
-                UnSelectedImagePath = "ZigeeLogic/back.png",
-            };
-            topRowLayout.AddChidren(back);
-            back.MouseDownEventHandler += (sender, e) =>
-            {
-                RemoveFromParent();
-            };
+            #region  涓婇潰鐨勫竷灞�浠g爜
+            TopView view = new TopView();
+            this.AddChidren(view.TopRowView());
+            view.toptitleNameBtn.TextID = MyInternationalizationString.linkageevent;
+            view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); };
 
             var addiocn = new Button
             {
@@ -73,7 +30,7 @@
                 UnSelectedImagePath = "ZigeeLogic/lockadd.png",
                 Y = Application.GetRealHeight(184 - 72 - 20),
             };
-            topRowLayout.AddChidren(addiocn);
+            view.topRowLayout.AddChidren(addiocn);
             addiocn.MouseUpEventHandler += (sender, e) =>
             {
                 //new涓�涓柊閫昏緫瀵硅薄锛�
@@ -81,26 +38,37 @@
                 Common.Logic.CurrentLogic.IsEnable = 1;//榛樿涓哄紑
                 Common.Logic.CurrentLogic.LogicType = 1;
                 Common.Logic.CurrentLogic.Relationship = 1;
-                //Config.Instance.Guid鐢ㄦ潵璇嗗埆璐﹀彿韬唤锛�
-                var accounts = new System.Collections.Generic.Dictionary<string, string>();
-                accounts.Add("Account", Config.Instance.Guid);
-                Common.Logic.CurrentLogic.Accounts.Add(accounts);
                 Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1);
+                //Common.Logic.CurrentLogic.LogicCustomPushText = Common.Logic.CurrentLogic.LogicName + Language.StringByID(MyInternationalizationString.defaulttext);
                 var lockLogicCommunalPage = new LockLogicCommunalPage();
                 UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
                 UserView.HomePage.Instance.PageIndex += 1;
                 lockLogicCommunalPage.Show(() => { });
             };
             #endregion
-
-            middle = new VerticalScrolViewLayout
+            middle = new VerticalRefreshLayout
             {
-                Y = topRowLayout.Bottom,
+                Y = view.topRowLayout.Bottom,
                 Height = Application.GetRealHeight(1920 - 184),
                 BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
             };
             this.AddChidren(middle);
+            middle.BeginHeaderRefreshingAction += () =>
+            {
+                //閲嶆柊鍒锋柊logic鍒楄〃
+                Common.Logic.LockLogicList.Clear();
+                Read();
+                //鍏抽棴鍒锋柊View锛�
+                middle.EndHeaderRefreshing();
+            };
+            Read();
+        }
 
+        /// <summary>
+        /// 璇诲彇鑷姩鍖栨暟鎹�
+        /// </summary>
+        public async void Read()
+        {
             CommonPage.Loading.Start();
             if (Common.Logic.LockLogicList.Count == 0)
             {
@@ -133,14 +101,52 @@
                     }
                 }
             }
-            //鑷姩鍖�
             Automationview();
             CommonPage.Loading.Hide();
         }
-
-        void Automationview()
+        /// <summary>
+        /// 鍔犺浇鑷姩鍖栧垪琛ㄧ殑鐣岄潰
+        /// </summary>
+        public void Automationview()
         {
             middle.RemoveAll();
+
+            if (Common.Logic.LockLogicList.Count == 0)
+            {
+                //灏辨槸涓轰簡鏄剧ず寮曞娣诲姞鍥炬爣;
+                var noFrameLayout = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(434 + 200 + 32 + 320),
+                    //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                };
+                middle.AddChidren(noFrameLayout);
+
+
+                var noIconBtn = new Button
+                {
+                    Y = Application.GetRealHeight(320),
+                    Width = Application.GetMinRealAverage(756),
+                    Height = Application.GetMinRealAverage(434),
+                    UnSelectedImagePath = "Item/NoFunction.png",
+                    X = Application.GetRealWidth(162),
+                };
+                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.tiplocktextnull).Replace("{\\r\\n}", "\r\n"),
+                    TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
+                    TextAlignment = TextAlignment.Center,
+                    IsMoreLines = true,
+                    X = Application.GetRealWidth(190),
+                };
+                noFrameLayout.AddChidren(noTextBtn);
+
+            }
             for (int i = 0; i < Common.Logic.LockLogicList.Count; i++)
             {
                 var logic = Common.Logic.LockLogicList[i];
@@ -148,7 +154,7 @@
                 {
                     Width = Application.GetRealWidth(1080),
                     Height = Application.GetRealHeight(190),
-                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
+                    LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                     BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
 
                 };
@@ -163,6 +169,7 @@
                     TextAlignment = TextAlignment.CenterLeft,
                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                     Gravity = Gravity.CenterVertical,
+                    TextSize = 15,
                 };
                 logicRowlayout.AddChidren(logicnameBtn);
 
@@ -194,6 +201,14 @@
                     Send.LogicControlSwitch(logic);
 
                 };
+                if (logic.IsEnable == 1)
+                {
+                    logicswitchBtn.IsSelected = true;
+                }
+                else if (logic.IsEnable == 0)
+                {
+                    logicswitchBtn.IsSelected = false;
+                }
                 ///缂栬緫
                 var edit = new Button
                 {
@@ -229,7 +244,7 @@
                     {
                         if (e1)
                         {
-                            Common.Logic.LogicList.Remove(logic);
+                            Common.Logic.LockLogicList.Remove(logic);
                             Automationview();
                             Send.DelLogic(logic.LogicId);
                         }

--
Gitblit v1.8.0