From 59ab4de7a58a8da55f2136440269c60a1172e16d Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期三, 20 十一月 2019 17:29:06 +0800
Subject: [PATCH] 2019-11-20-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/Send.cs                                |    1 
 ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs                          |   60 +++++------
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs          |   77 +++++++++++----
 ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml                                     |   28 ++++-
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs |   75 ++++----------
 ZigbeeApp/GateWay.Ios/MainViewController.cs                                |    3 
 ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs                |    8 -
 ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide                               |    0 
 ZigbeeApp/Shared/Phone/UserView/HomePage.cs                                |    2 
 ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs             |    6 
 10 files changed, 136 insertions(+), 124 deletions(-)

diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
index f0396a8..6664264 100644
--- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
+++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
@@ -2,24 +2,40 @@
   <MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.SelectDevice" />
   <MonoDevelop.Ide.ItemProperties.GateWay.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.913cb77b0eef11c9119c61a02bc00fec01bf67d6" />
   <MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.M7BBB18B19152766" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/LogicCommunalPage.cs">
     <Files>
-      <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs" Line="490" Column="43" />
+      <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs" Line="339" Column="51" />
+      <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs" Line="418" Column="82" />
+      <File FileName="Shared/Phone/UserView/HomePage.cs" Line="97" Column="64" />
+      <File FileName="Shared/Phone/Device/Logic/Send.cs" Line="470" Column="76" />
+      <File FileName="Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs" Line="249" Column="1" />
+      <File FileName="Shared/Common/CommonPage.cs" Line="42" Column="52" />
+      <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" Line="536" Column="30" />
+      <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" Line="723" Column="1" />
+      <File FileName="Shared/Phone/Device/Logic/DeviceStateCondition.cs" Line="1450" Column="54" />
+      <File FileName="Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs" Line="215" Column="59" />
+      <File FileName="Shared/Common/Logic.cs" Line="66" Column="15" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
         <State name="__root__">
           <Node name="GateWay" expanded="True">
-            <Node name="GateWay.Ios" expanded="True" />
+            <Node name="GateWay.Ios" expanded="True">
+              <Node name="Resources" expanded="True" />
+            </Node>
             <Node name="Shared" expanded="True">
+              <Node name="Common" expanded="True" />
               <Node name="Phone" expanded="True">
                 <Node name="Device" expanded="True">
                   <Node name="Logic" expanded="True">
-                    <Node name="DoorLockLogic" expanded="True">
-                      <Node name="LockLogicCommunalPage.cs" selected="True" />
-                    </Node>
+                    <Node name="DoorLockLogic" expanded="True" />
+                    <Node name="LogicCommunalPage.cs" selected="True" />
                   </Node>
                 </Node>
+                <Node name="UserCenter" expanded="True">
+                  <Node name="DoorLock" expanded="True" />
+                </Node>
+                <Node name="UserView" expanded="True" />
               </Node>
             </Node>
           </Node>
diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
index 3ca7f17..61e5425 100644
--- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
+++ b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
Binary files differ
diff --git a/ZigbeeApp/GateWay.Ios/MainViewController.cs b/ZigbeeApp/GateWay.Ios/MainViewController.cs
old mode 100755
new mode 100644
index cb67d11..fec7566
--- a/ZigbeeApp/GateWay.Ios/MainViewController.cs
+++ b/ZigbeeApp/GateWay.Ios/MainViewController.cs
@@ -25,9 +25,8 @@
             Reachability.ReachabilityChanged += UpdateStatus;          
             //UIApplication.SharedApplication.SetStatusBarHidden(true, true);
             Shared.Application.RootFrameLayout = View;
-
+            
             Shared.Common.CommonPage.Instance.Show();
-
 
 
             UITapGestureRecognizer oTapRecognizer = new UITapGestureRecognizer();
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
index c65bb84..62e6cc9 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
@@ -733,8 +733,6 @@
             flMain.MouseUpEventHandler += (sender, e) =>
             {
                 flMain.RemoveFromParent();
-
-
             };
 
             var devicefra1 = new FrameLayout
@@ -1192,7 +1190,7 @@
                             dictionary(deviceConditionsInfo, "AttriButeData1", "0");
                             if (iASZonedevice.IasDeviceType == 13)
                             {
-                                SelectedDeviceStatuscondition = "no";
+                                SelectedDeviceStatuscondition = "";
                                 btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                 btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                 openBtnSelected.Visible = false;
@@ -1274,7 +1272,7 @@
                                     timeoutrowlayout.AddChidren(timeoutBtnSelected);
                                     EventHandler<MouseEventArgs> timeoutclick = (sender, e) =>
                                     {
-                                        SelectedDeviceStatuscondition = "no";
+                                        SelectedDeviceStatuscondition = "";
                                         btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                         btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                         openBtnSelected.Visible = false;
@@ -1293,7 +1291,6 @@
                                     #endregion
                                 }
                                 break;
-
                             case 40:
                                 {
                                     devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
@@ -1333,7 +1330,6 @@
                                     openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
                                 }
                                 break;
-
                             case 277:
                                 {
                                     devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
index dae8177..e009bb3 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
@@ -12,7 +12,7 @@
             Tag = "LockLogic";
         }
         Button selectedIcon = new Button();
-       
+        VerticalScrolViewLayout middle;
         public int conditionsIndex = -1;
         public async void Show()
         {
@@ -68,7 +68,7 @@
 
             #endregion
 
-            var middle = new VerticalScrolViewLayout
+            middle = new VerticalScrolViewLayout
             {
                 Y = topRowLayout.Bottom,
                 Height = Application.GetRealHeight(1920 - 184),
@@ -86,23 +86,21 @@
                     d = true;
                     break;
                 }
-
             }
-
+            CommonPage.Loading.Start();
             if (!d)
             {
-               
                 var allMemberslist = await Send.AllMembers(Send.CurrentDoorLock.DeviceAddr);
                 Send.LockList.AddRange(allMemberslist);
             }
-            UserAllView(middle, macport);
+            UserAllView(macport);
+            CommonPage.Loading.Hide();
 
         }
         /// <summary>
         /// 鏄剧ず鎵�鏈夌敤鎴�
         /// </summary>
-        /// <param name="middle"></param>
-        void UserAllView(VerticalScrolViewLayout middle,string macport)
+        void UserAllView(string macport)
         {
 
             for (int i = 0; i < Send.LockList.Count; i++)
@@ -154,7 +152,7 @@
 
                 EventHandler<MouseEventArgs> userclick = (sender, e) =>
                 {
-                    SelectedUserID(user.UserIdMode, usernameBtn.Text);
+                    SelectedUserID(user);
                 };
                 usernameBtn.MouseUpEventHandler += userclick;
                 btntimeback.MouseUpEventHandler += userclick;
@@ -169,7 +167,7 @@
         /// </summary>
         /// <param name="membershipIfon">瑙﹀彂婧愬垪琛�</param>
         /// <param name="userName">鐢ㄦ埛鍚嶅瓧</param>
-        void SelectedUserID(List<Send.UnlockingMode> membershipIfon, string userName) {
+        void SelectedUserID(Send.MembershipIfon membershipIfon) {
 
            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
             this.AddChidren(flMain);
@@ -233,7 +231,7 @@
                 TextAlignment = TextAlignment.Center,
                 X = Btncancel.Right + Application.GetRealWidth(100),
                 TextSize = 16,
-                Text =userName,
+                Text = membershipIfon.UserName,
             };
             lockRow.AddChidren(Btntitle);
             var Btncomplete = new Button
@@ -251,13 +249,15 @@
             #endregion
 
             string SelectedLockStatus = "";
-            lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.Count) - 20 - 50);
-            lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.Count) + 20 + 50);
+            lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.UserIdMode.Count) - 20 - 50);
+            lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.UserIdMode.Count) + 20 + 50);
             ///瀹氫箟涓や釜鍙橀噺璁板綍閫変腑鐘舵�侊紱
-            string attriButeId ="", attriButeData2 ="";
-            for (int j = 0; j < membershipIfon.Count; j++)
+            string attriButeId = "";
+            string attriButeData2 = "";
+            string modeName = "";
+            for (int j = 0; j < membershipIfon.UserIdMode.Count; j++)
             {
-                var userIdmode = membershipIfon[j];
+                var userIdmode = membershipIfon.UserIdMode[j];
                 var doorlockfra = new FrameLayout
                 {
                     Height = Application.GetRealHeight(160),
@@ -316,7 +316,7 @@
 
                 };
                 doorlockRow.AddChidren(doorlockSelected);
-                if ((membershipIfon.Count - 1) == j)
+                if ((membershipIfon.UserIdMode.Count - 1) == j)
                 {
                     doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
                 }
@@ -329,6 +329,7 @@
                     //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                     attriButeId = userIdmode.OpenMode.ToString();
                     attriButeData2 = userIdmode.UserId;
+                    modeName = userIdmode.ModeName;
                 };
                 doorlockRow.MouseUpEventHandler += doorlockclick;
                 doorlockBtn.MouseUpEventHandler += doorlockclick;
@@ -344,6 +345,8 @@
                         selectedIcon = doorlockSelected;
                         doorlockSelected.Visible = true;
                     }
+                    
+
                 }
             }
            
@@ -359,11 +362,16 @@
                 lockConditionsInfo.Add("AttriButeData2", attriButeData2);
                 lockConditionsInfo.Add("AttriButeData1", "2");
                 lockConditionsInfo.Add("Range", "0");
+                var accounts = new Dictionary<string, string>();
+                accounts.Add("Type", "1");
+                accounts.Add("Account", membershipIfon.UserName+ modeName);
+                accounts.Add("UserId", attriButeData2);
                 if (SelectedLockStatus != "")
                 {
                     if (conditionsIndex == -1)
                     {
-                        bool add = false;
+                        bool addCondition = false;
+                        bool addAccount = false;
                         for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++)
                         {
                             if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "1")
@@ -372,23 +380,50 @@
                                 {
                                     if (Common.Logic.CurrentLogic.Conditions[i]["AttriButeId"] == lockConditionsInfo["AttriButeId"] && Common.Logic.CurrentLogic.Conditions[i]["AttriButeData2"] == lockConditionsInfo["AttriButeData2"])
                                     {
-                                        add = true;
+                                        addCondition = true;
                                         break;
                                     }
                                 }
                             }
                         }
-                        
-                        if (!add)
+                        if (!addCondition)
                         {
                             Common.Logic.CurrentLogic.Conditions.Add(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]["Account"] == membershipIfon.UserName + modeName && Common.Logic.CurrentLogic.Accounts[i]["UserId"] == attriButeData2)
+                                {
+                                    addAccount = true;
+                                    break;
+                                }
+                            }
+                        }
+                        if (!addAccount)
+                        {
+                            Common.Logic.CurrentLogic.Accounts.Add(accounts);
+                        }
                     }
                     else
                     {
                         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)
+                                {
+                                    Common.Logic.CurrentLogic.Accounts.RemoveAt(i);
+                                    Common.Logic.CurrentLogic.Accounts.Insert(i, accounts);
+                                    break;
+                                }
+                            }
+                        }
+
                     }
 
                 }
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
index ef89b3c..52f8b4a 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
@@ -193,11 +193,7 @@
             ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠�
             EventHandler<MouseEventArgs> conditionaddclick = (sender, e) =>
             {
-                var addCondition = new AddCondition();
-                addCondition.conditionsIndex = -1;
-                UserView.HomePage.Instance.AddChidren(addCondition);
-                UserView.HomePage.Instance.PageIndex += 1;
-                addCondition.Show();
+                AddCondition(-1);
             };
             conditionadd.MouseUpEventHandler += conditionaddclick;
             conditionadd1.MouseUpEventHandler += conditionaddclick;
@@ -234,19 +230,14 @@
                         Y = Application.GetRealHeight(45 + 30),
                         TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                         TextID = MyInternationalizationString.selectunlockingmode,
-                        X = Application.GetRealWidth(390),
+                        X = Application.GetRealWidth(290),
                         TextSize = 14,
                     };
                     addfl.AddChidren(addtextbtn);
 
                     EventHandler<MouseEventArgs> addconditionsclick = (sender, e) =>
                     {
-                        var addCondition = new AddCondition();
-                        ///璁板綍绱㈠紩
-                        addCondition.conditionsIndex = -1;
-                        UserView.HomePage.Instance.AddChidren(addCondition);
-                        UserView.HomePage.Instance.PageIndex += 1;
-                        addCondition.Show();
+                        AddCondition(-1);
                     };
                     addbtn.MouseUpEventHandler += addconditionsclick;
                     addtextbtn.MouseUpEventHandler += addconditionsclick;
@@ -326,17 +317,14 @@
                                     BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
                                     Text = Language.StringByID(MyInternationalizationString.edit),
                                     TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
-                                    Tag=i,
+                                    Tag = i,
                                 };
                                 conditionsRowLayout.AddRightView(deviceedit);
                                 deviceedit.MouseUpEventHandler += (sender, e) =>
                                 {
-                                    var addCondition = new AddCondition();
-                                    ///璁板綍绱㈠紩
-                                    addCondition.conditionsIndex = int.Parse(deviceedit.Tag.ToString());
-                                    UserView.HomePage.Instance.AddChidren(addCondition);
-                                    UserView.HomePage.Instance.PageIndex += 1;
-                                    addCondition.Show();
+
+                                    int intvalue = int.Parse(deviceedit.Tag.ToString());
+                                    AddCondition(intvalue);
                                 };
 
                                 ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
@@ -357,39 +345,17 @@
                                     case DeviceType.DoorLock:
                                         {
                                             conditionIcon.UnSelectedImagePath = "ZigeeLogic/doorlock.png";
-                                            //for (int a = 0; a < Common.Logic.CurrentLogic.Accounts.Count; a++)
-                                            //{
-                                            //    if (Common.Logic.CurrentLogic.Accounts[a]["Type"] == "1")
-                                            //    {
-                                            //        if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"])
-                                            //        {
-                                            //            devicestatus.Text = Common.Logic.CurrentLogic.Accounts["Account"];
-                                            //            break;
-                                            //        }
-                                            //    }
-                                            //}
-
-                                            //(0鎸夐敭/3鍗�/15鎸囩汗)
-                                            switch (conditions["AttriButeId"])
+                                            for (int a = 0; a < Common.Logic.CurrentLogic.Accounts.Count; a++)
                                             {
-                                                case "0":
+                                                if (Common.Logic.CurrentLogic.Accounts[a]["Type"] == "1")
+                                                {
+                                                    if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"])
                                                     {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.lockpassword);
+                                                        devicestatus.Text = Common.Logic.CurrentLogic.Accounts[a]["Account"];
+                                                        break;
                                                     }
-                                                    break;
-                                                case "3":
-                                                    {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.ic);
-                                                    }
-                                                    break;
-                                                case "15":
-                                                    {
-                                                        devicestatus.Text = Language.StringByID(MyInternationalizationString.fingerprint);
-                                                    }
-                                                    break;
-
+                                                }
                                             }
-
                                         }
                                         break;
                                 }
@@ -404,10 +370,8 @@
                         Text = Language.StringByID(MyInternationalizationString.del),
                     };
                     conditionsRowLayout.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) =>
@@ -643,7 +607,7 @@
                                 ///缂栬緫鐐瑰嚮浜嬩欢
                                 deviceedit.MouseUpEventHandler += (sender, e) =>
                                 {
-                                   
+
                                     var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                                     this.AddChidren(flMain);
                                     LockAddDevice.CurrentDeviceStateView(flMain, deviceinof, true);
@@ -1156,5 +1120,14 @@
             };
 
         }
+        public  void AddCondition(int value)
+        {
+            var addCondition = new AddCondition();
+            addCondition.conditionsIndex = value;
+            UserView.HomePage.Instance.AddChidren(addCondition);
+            UserView.HomePage.Instance.PageIndex += 1;
+            addCondition.Show();
+      
+        }
     }
 }
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
index 79df66a..423a369 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
@@ -225,7 +225,10 @@
                     lockRow.AddChidren(Btncomplete);
                     #endregion
                     ///瀹氫袱涓彉閲忚褰曚箣鍓嶇殑鍙�硷紱
-                    string userId = "", openMode = "", accountname="", SelectedDeviceStatuscondition = "";
+                    string userId = "";
+                    string openMode = "";
+                    string accountname = "";
+                    string  SelectedDeviceStatuscondition = "";
                     lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * user.UserIdMode.Count) - 20 - 50);
                     lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * user.UserIdMode.Count) + 20 + 50);
                     for (int i = 0; i < user.UserIdMode.Count; i++)
@@ -257,25 +260,7 @@
                             TextSize = 14,
                         };
                         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;
-                        //}
+                      
                         var doorlockSelected = new Button
                         {
                             X = Application.GetRealWidth(860),
@@ -301,7 +286,6 @@
                             openMode = userifon.OpenMode.ToString();
                             accountname = Btntitle.Text + doorlockBtn.Text;
                             //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-
                         };
                         doorlockRow.MouseUpEventHandler += doorlockclick;
                         doorlockBtn.MouseUpEventHandler += doorlockclick;
@@ -352,7 +336,8 @@
                         }
                         if (SelectedDeviceStatuscondition != "")
                         {
-                            bool add = false;
+                            bool addConditions = false;
+                            bool addAccounts = false;
                             for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++)
                             {
                                 if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "1")
@@ -363,26 +348,33 @@
                                         {
                                             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"] == userIdstr)
-                                                {
-                                                    Common.Logic.CurrentLogic.Accounts.RemoveAt(j);
-                                                    Common.Logic.CurrentLogic.Accounts.Insert(j, userdictionary);
-                                                }
-                                            }
-                                            add = true;
+                                            addConditions = true;
                                             break;
                                         }
                                     }
                                 }
                             }
-                            if (!add)
+                            for (int j = 0; j < Common.Logic.CurrentLogic.Accounts.Count; j++)
                             {
-                                Common.Logic.CurrentLogic.Accounts.Add(userdictionary);
+                                if (Common.Logic.CurrentLogic.Accounts[j]["Type"] == "1")
+                                {
+                                    if (Common.Logic.CurrentLogic.Accounts[j]["UserId"] == userIdstr)
+                                    {
+                                        Common.Logic.CurrentLogic.Accounts.RemoveAt(j);
+                                        Common.Logic.CurrentLogic.Accounts.Insert(j, userdictionary);
+                                        addAccounts = true;
+                                        break;
+                                    }
+                                }
+                            }
+                            if (!addConditions)
+                            {
                                 Common.Logic.CurrentLogic.Conditions.Add(deviceConditionsInfo);
                             }
-
+                            if (!addAccounts)
+                            {
+                                Common.Logic.CurrentLogic.Accounts.Add(userdictionary);
+                            }
                         }
                         else
                         {
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
index 8c9a7fd..0cce7a7 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
@@ -467,6 +467,7 @@
                                         {
                                             ["Type"] = int.Parse(dictionary["Type"]),
                                             ["Account"] = dictionary["Account"],
+                                            ["UserId"] = dictionary["UserId"],
 
                                         };
                                         accounts.Add(accounts1);
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs
index 4a2935f..5ca63f0 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs
@@ -925,7 +925,7 @@
                             dictionary(deviceConditionsInfo, "AttriButeData1", "0");
                             if (iASZonedevice.IasDeviceType == 13)
                             {
-                                SelectedDeviceStatuscondition = "no";
+                                SelectedDeviceStatuscondition = "";
                                 btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                 btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                 openBtnSelected.Visible = false;
@@ -1007,7 +1007,7 @@
                                     timeoutrowlayout.AddChidren(timeoutBtnSelected);
                                     EventHandler<MouseEventArgs> timeoutclick = (sender, e) =>
                                     {
-                                        SelectedDeviceStatuscondition = "no";
+                                        SelectedDeviceStatuscondition = "";
                                         btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                         btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                         openBtnSelected.Visible = false;
@@ -1026,7 +1026,6 @@
                                     #endregion
                                 }
                                 break;
-
                             case 40:
                                 {
                                     devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
@@ -1066,7 +1065,6 @@
                                     openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
                                 }
                                 break;
-
                             case 277:
                                 {
                                     devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50);
diff --git a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs
old mode 100755
new mode 100644
index 11eef73..0ba8d94
--- a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs
@@ -8,6 +8,7 @@
     /// </summary>
     public class HomePage : PageLayout
     {
+    
         static HomePage homePage;
         /// <summary>
         /// Gets the instance.
@@ -29,6 +30,7 @@
         /// </summary>
         public void InitPage()
         {
+            
             if (0 < ChildrenCount)
             {
                 return;

--
Gitblit v1.8.0