From 653b65a9bd3d3df806f7cbecc767085cd506058d Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 14 十一月 2019 16:30:39 +0800
Subject: [PATCH] 2019-11-14-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs |   91 ++++++++++++++++++++++++++++++---------------
 1 files changed, 60 insertions(+), 31 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
index bc56662..d1b1526 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
@@ -14,7 +14,6 @@
             Tag = "Logic";
         }
         Button selectedIcon = new Button();
-        public static Action action;
         public static bool edit=false;
       
 
@@ -56,7 +55,6 @@
             clickBtn.MouseDownEventHandler += (sender, e) =>
             {
                 RemoveFromParent();
-                action();
             };
 
             var back = new Button
@@ -82,19 +80,39 @@
                 BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
             };
             this.AddChidren(middle);
-            if (Send.UserList.Count == 0)
+
+
+            bool d = false;
+            string macport = common.DeviceAddr + "_" + common.DeviceEpoint.ToString();
+            for (int i = 0; i < Send.LockList.Count; i++)
+            {
+                if (Send.LockList[i].DoorLockMacPort == macport)
+                {
+                    ///宸茬粡瀛樺湪璇ラ棬閿佷俊鎭�
+                    d = true;
+                    break;
+                }
+
+            }
+
+            if (!d)
             {
                 var allMemberslist = await Send.AllMembers(common.DeviceAddr);
-                Send.UserList.AddRange(allMemberslist);
+                Send.LockList.AddRange(allMemberslist);
             }
-            foreach (var user in Send.UserList)
-            {
 
-                var userFramelayout = new RowLayout
+       
+            foreach (var user in Send.LockList)
+            {
+                if (user.DoorLockMacPort != macport)
+                {
+                    continue;
+                }
+                var userFramelayout = new FrameLayout
                 {
                     Height = Application.GetRealHeight(160),
                     BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
-                    LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                   // LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                 };
                 middle.AddChidren(userFramelayout);
 
@@ -111,7 +129,7 @@
 
                 var userBtn = new Button
                 {
-                    Text = user.MembershipName,
+                    Text = user.UserName,
                     TextAlignment = TextAlignment.CenterLeft,
                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                 };
@@ -188,7 +206,7 @@
                         TextAlignment = TextAlignment.Center,
                         X = Btncancel.Right + Application.GetRealWidth(100),
                         TextSize = 16,
-                        Text = user.MembershipName,
+                        Text = user.UserName,
                     };
                     lockRow.AddChidren(Btntitle);
                     var Btncomplete = new Button
@@ -232,27 +250,28 @@
                             Width = Application.GetRealWidth(600),
                             TextAlignment = TextAlignment.CenterLeft,
                             TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
+                            Text= userifon.ModeName,
                         };
                         doorlockRow.AddChidren(doorlockBtn);
                         //(1鎸夐敭/3鍗�/15鎸囩汗)
-                        switch (userifon.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;
-                        }
+                        //switch (userifon.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
                         {
                             X = Application.GetRealWidth(860),
@@ -302,6 +321,7 @@
 
                     Btncomplete.MouseUpEventHandler += (sender3, e3) =>
                     {
+                        string userIdstr = "", openModestr="";
                         var deviceConditionsInfo = new Dictionary<string, string>();
                         var userdictionary = new Dictionary<string, string>();
                         deviceConditionsInfo.Add("Type", "1");
@@ -316,7 +336,16 @@
                         userdictionary.Add("Account",accountname);
                         userdictionary.Add("Type", "1");
                         userdictionary.Add("UserId", userId);
-
+                        if (edit)
+                        {
+                            openModestr = editdeviceConditionsInfo["AttriButeId"];
+                            userIdstr = editdeviceConditionsInfo["AttriButeData2"];
+                        }
+                        else
+                        {
+                            openModestr = deviceConditionsInfo["AttriButeId"];
+                            userIdstr = deviceConditionsInfo["AttriButeData2"];
+                        }
                         if (SelectedDeviceStatuscondition != "")
                         {
                             bool add = false;
@@ -326,13 +355,13 @@
                                 {
                                     if ((Common.Logic.CurrentLogic.Conditions[i]["MacAddr"] == common.DeviceAddr) && (Common.Logic.CurrentLogic.Conditions[i]["Epoint"] == common.DeviceEpoint.ToString()))
                                     {
-                                        if (Common.Logic.CurrentLogic.Conditions[i]["AttriButeId"] == editdeviceConditionsInfo["AttriButeId"] && Common.Logic.CurrentLogic.Conditions[i]["AttriButeData2"] == editdeviceConditionsInfo["AttriButeData2"])
+                                        if (Common.Logic.CurrentLogic.Conditions[i]["AttriButeId"] == openModestr && Common.Logic.CurrentLogic.Conditions[i]["AttriButeData2"] == userIdstr)
                                         {
                                             Common.Logic.CurrentLogic.Conditions.RemoveAt(i);
                                             Common.Logic.CurrentLogic.Conditions.Insert(i, deviceConditionsInfo);
                                             for (int j = 0; j < Common.Logic.CurrentLogic.Accounts.Count; j++)
                                             {
-                                                if (Common.Logic.CurrentLogic.Accounts[j]["UserId"] == editdeviceConditionsInfo["AttriButeData2"])
+                                                if (Common.Logic.CurrentLogic.Accounts[j]["UserId"] == userIdstr)
                                                 {
                                                     Common.Logic.CurrentLogic.Accounts.RemoveAt(j);
                                                     Common.Logic.CurrentLogic.Accounts.Insert(j, userdictionary);

--
Gitblit v1.8.0