From 6fa9d69da922c8049f5acfcbb9ce9fd26811024c Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 16 四月 2020 17:10:57 +0800
Subject: [PATCH] 请合并代码

---
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs |  157 +++++++++++++++++++++++++++-------------------------
 1 files changed, 82 insertions(+), 75 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
index ebf8d23..c4efc33 100755
--- 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 = "LockListView";
         }
-        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 = 17,
-                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                X = Application.GetRealWidth(176),
-                Width = Application.GetRealWidth(600),
-                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,30 +30,44 @@
                 UnSelectedImagePath = "ZigeeLogic/lockadd.png",
                 Y = Application.GetRealHeight(184 - 72 - 20),
             };
-            topRowLayout.AddChidren(addiocn);
+            view.topRowLayout.AddChidren(addiocn);
             addiocn.MouseUpEventHandler += (sender, e) =>
             {
                 //new涓�涓柊閫昏緫瀵硅薄锛�
                 Common.Logic.CurrentLogic = new Common.Logic();
                 Common.Logic.CurrentLogic.IsEnable = 1;//榛樿涓哄紑
-                Common.Logic.CurrentLogic.LogicType = 1;
+                Common.Logic.CurrentLogic.LogicType = 1;//鏍囪鑷姩鍖栫被鍨�
                 Common.Logic.CurrentLogic.Relationship = 1;
-                Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1);
+                Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.linkageevent);
                 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,
-                Height = Application.GetRealHeight(1920 - 184),
+                Y = view.topRowLayout.Bottom,
+                Height = Application.GetRealHeight(Method.H - 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)
             {
@@ -108,7 +79,7 @@
                     for (int j = 0; j < listlogic.Count; j++)
                     {
                         var logic = listlogic[j];
-                        if (logic.LogicType == 0)
+                        if (logic.LogicType != 1)
                         {
                             continue;
                         }
@@ -129,14 +100,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];
@@ -146,6 +155,7 @@
                     Height = Application.GetRealHeight(190),
                     LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                     BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+                    SubViewWidth = Application.GetRealWidth(184),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛�
 
                 };
                 middle.AddChidren(logicRowlayout);
@@ -166,8 +176,8 @@
 
                 var logicswitchBtn = new Button
                 {
-                    Width = Application.GetMinRealAverage(104),
-                    Height = Application.GetMinRealAverage(63),
+                    Width = Application.GetRealWidth(104),
+                    Height = Application.GetRealHeight(63),
                     UnSelectedImagePath = "ZigeeLogic/logicclose.png",
                     SelectedImagePath = "ZigeeLogic/logicopen.png",
                     X = logicRowlayout.Width - Application.GetRealWidth(104 + 58),
@@ -217,7 +227,6 @@
 
                 };
 
-
                 ///鍒犻櫎
                 var del = new Button
                 {
@@ -228,18 +237,16 @@
                 logicRowlayout.AddRightView(del);
                 del.MouseUpEventHandler += (sender, e) =>
                 {
-                    var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete),
-                                             Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim));
-                    alert.ResultEventHandler += (sender1, e1) =>
+                    var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+                    Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+                    Language.StringByID(MyInternationalizationString.confrim));
+                    alert.Show();
+                    alert.ConfirmClickEvent += () =>
                     {
-                        if (e1)
-                        {
-                            Common.Logic.LockLogicList.Remove(logic);
-                            Automationview();
-                            Send.DelLogic(logic.LogicId);
-                        }
+                        Common.Logic.LockLogicList.Remove(logic);
+                        Automationview();
+                        Send.DelLogic(logic.LogicId);
                     };
-                    alert.Show();
 
                 };
             }

--
Gitblit v1.8.0