From ef63c84b3b408fea661f84d3f9ecc237787af250 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 09 十二月 2019 11:10:07 +0800
Subject: [PATCH] 2019-12-09-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs |   87 ++++++++++++++++++++++---------------------
 1 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
index e009bb3..36a7fc5 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
@@ -12,9 +12,10 @@
             Tag = "LockLogic";
         }
         Button selectedIcon = new Button();
-        VerticalScrolViewLayout middle;
+        VerticalRefreshLayout middle;
         public int conditionsIndex = -1;
-        public async void Show()
+
+        public void Show()
         {
             #region  鏈�涓婇潰鐨勫竷灞�浠g爜
             var topRowLayout = new RowLayout
@@ -68,14 +69,38 @@
 
             #endregion
 
-            middle = new VerticalScrolViewLayout
+            middle = new VerticalRefreshLayout
             {
                 Y = topRowLayout.Bottom,
                 Height = Application.GetRealHeight(1920 - 184),
                 BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
             };
             this.AddChidren(middle);
+            middle.BeginHeaderRefreshingAction += () =>
+            {
+                //閲嶆柊鍒锋柊logic鍒楄〃
+                string macport = Send.CurrentDoorLock.DeviceAddr + "_" + Send.CurrentDoorLock.DeviceEpoint.ToString();
+                for (int i = 0; i < Send.LockList.Count; i++)
+                {
+                    if (Send.LockList[i].DoorLockMacPort == macport)
+                    {
+                        ///浠庡垪琛ㄧЩ闄ゅ綋鍓嶉棬閿佸叏閮ㄧ殑鏃ф暟鎹紱
+                        Send.LockList.Remove(Send.LockList[i]);
+                        i--;
+                    }
+                }
+                Read();
+                //鍏抽棴鍒锋柊View锛�
+                middle.EndHeaderRefreshing();
+            };
+            Read();
 
+        }
+        /// <summary>
+        /// 璇诲彇褰撳墠闂ㄩ攣鐨勪簯绔暟鎹紱
+        /// </summary>
+        public async void Read()
+        {
             bool d = false;
             string macport = Send.CurrentDoorLock.DeviceAddr + "_" + Send.CurrentDoorLock.DeviceEpoint.ToString();
             for (int i = 0; i < Send.LockList.Count; i++)
@@ -95,14 +120,13 @@
             }
             UserAllView(macport);
             CommonPage.Loading.Hide();
-
         }
         /// <summary>
         /// 鏄剧ず鎵�鏈夌敤鎴�
         /// </summary>
-        void UserAllView(string macport)
+        public void UserAllView(string macport)
         {
-
+            middle.RemoveAll();
             for (int i = 0; i < Send.LockList.Count; i++)
             {
                 var user = Send.LockList[i];
@@ -166,10 +190,10 @@
         /// 閫夋嫨鏌愪釜鐢ㄦ埛
         /// </summary>
         /// <param name="membershipIfon">瑙﹀彂婧愬垪琛�</param>
-        /// <param name="userName">鐢ㄦ埛鍚嶅瓧</param>
-        void SelectedUserID(Send.MembershipIfon membershipIfon) {
+        public void SelectedUserID(Send.MembershipIfon membershipIfon)
+        {
 
-           var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
             this.AddChidren(flMain);
 
             flMain.MouseUpEventHandler += (sender1, e1) =>
@@ -177,14 +201,7 @@
                 flMain.RemoveFromParent();
             };
 
-            var lockcolorfra = new FrameLayout
-            {
-                Width = Application.GetRealWidth(1080),
-                Height = Application.GetRealHeight(100),
-                Y = Application.GetRealHeight(1920 - 100),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
-            };
-            flMain.AddChidren(lockcolorfra);
+
 
             var lockcolorfra1 = new FrameLayout
             {
@@ -196,6 +213,7 @@
                 Radius = (uint)Application.GetRealHeight(60),
             };
             flMain.AddChidren(lockcolorfra1);
+            lockcolorfra1.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
 
             #region  -------鍙栨秷   瀹屾垚
             var lockRow = new RowLayout
@@ -284,26 +302,6 @@
                     TextSize = 14,
                 };
                 doorlockRow.AddChidren(doorlockBtn);
-                //(0鎸夐敭/3鍗�/15鎸囩汗)
-                //switch (userIdmode.OpenMode.ToString())
-                //{
-                //    case "0":
-                //        {
-                //            doorlockBtn.Text = Language.StringByID(MyInternationalizationString.lockpassword);
-                //        }
-                //        break;
-                //    case "3":
-                //        {
-                //            doorlockBtn.Text = Language.StringByID(MyInternationalizationString.ic);
-                //        }
-                //        break;
-                //    case "15":
-                //        {
-                //            doorlockBtn.Text = Language.StringByID(MyInternationalizationString.fingerprint);
-                //        }
-                //        break;
-                //}
-
 
                 var doorlockSelected = new Button
                 {
@@ -345,11 +343,11 @@
                         selectedIcon = doorlockSelected;
                         doorlockSelected.Visible = true;
                     }
-                    
+
 
                 }
             }
-           
+
             Btncomplete.MouseUpEventHandler += (sender, e) =>
             {
                 var lockConditionsInfo = new Dictionary<string, string>();
@@ -364,7 +362,7 @@
                 lockConditionsInfo.Add("Range", "0");
                 var accounts = new Dictionary<string, string>();
                 accounts.Add("Type", "1");
-                accounts.Add("Account", membershipIfon.UserName+ modeName);
+                accounts.Add("Account", membershipIfon.UserName + modeName);
                 accounts.Add("UserId", attriButeData2);
                 if (SelectedLockStatus != "")
                 {
@@ -395,7 +393,7 @@
                         {
                             if (Common.Logic.CurrentLogic.Accounts[i]["Type"] == "1")
                             {
-                                if (Common.Logic.CurrentLogic.Accounts[i]["Account"] == membershipIfon.UserName + modeName && Common.Logic.CurrentLogic.Accounts[i]["UserId"] == attriButeData2)
+                                if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == attriButeData2)
                                 {
                                     addAccount = true;
                                     break;
@@ -409,13 +407,16 @@
                     }
                     else
                     {
+                        ///鎵惧嚭涔嬪墠鐨勬棫鏁版嵁绉婚櫎鎺夛紝鍐嶉噸鏂版坊鍔犳柊鏁版嵁锛�
+                        string accountuserId = Common.Logic.CurrentLogic.Conditions[conditionsIndex]["AttriButeData2"];
                         Common.Logic.CurrentLogic.Conditions.RemoveAt(conditionsIndex);
                         Common.Logic.CurrentLogic.Conditions.Insert(conditionsIndex, lockConditionsInfo);
                         for (int i = 0; i < Common.Logic.CurrentLogic.Accounts.Count; i++)
                         {
                             if (Common.Logic.CurrentLogic.Accounts[i]["Type"] == "1")
                             {
-                                if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == attriButeData2)
+                                ///鎵惧嚭涔嬪墠鐨勬棫鏁版嵁绉婚櫎鎺夛紝鍐嶉噸鏂版坊鍔犳柊鏁版嵁锛�
+                                if (Common.Logic.CurrentLogic.Accounts[i]["UserId"] == accountuserId)
                                 {
                                     Common.Logic.CurrentLogic.Accounts.RemoveAt(i);
                                     Common.Logic.CurrentLogic.Accounts.Insert(i, accounts);
@@ -444,6 +445,6 @@
                 lockLogicCommunalPage.Show(() => { });
             };
         }
-    
+        
     }
 }

--
Gitblit v1.8.0