From f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 30 十二月 2019 13:32:33 +0800
Subject: [PATCH] 2019-12-30-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs                           |    1 
 ZigbeeApp/GateWay.Droid/Assets/Language.ini                                |    2 
 ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs                        |    1 
 ZigbeeApp/Home.Ios/Resources/Language.ini                                  |    1 
 ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs                        |   14 
 ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs                          |   39 +-
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs         |   37 ++
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs |   30 +
 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs                   |   62 +++-
 ZigbeeApp/Shared/R.cs                                                      |    1 
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs                         |   77 ++++-
 ZigbeeApp/Shared/Common/Logic.cs                                           |    2 
 ZigbeeApp/Shared/Phone/Device/Logic/Send.cs                                |  170 ++++++++++--
 ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs                          |    1 
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs          |  257 +++++++++++++------
 ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs                        |   39 ++
 16 files changed, 543 insertions(+), 191 deletions(-)

diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini
index 6e78af9..47658ff 100755
--- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini
+++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini
@@ -611,7 +611,7 @@
 5374=娣诲姞浼犳劅鍣�
 5375=娣诲姞寮�鍏�/鐏厜
 5376=搴旂敤
-
+5377=娌℃湁鑷姩鍖杮\r\n} 璇风偣鍑诲彸涓婅娣诲姞
 
 
 
diff --git a/ZigbeeApp/Home.Ios/Resources/Language.ini b/ZigbeeApp/Home.Ios/Resources/Language.ini
index 3633ba7..6383841 100755
--- a/ZigbeeApp/Home.Ios/Resources/Language.ini
+++ b/ZigbeeApp/Home.Ios/Resources/Language.ini
@@ -611,6 +611,7 @@
 5374=娣诲姞浼犳劅鍣�
 5375=娣诲姞寮�鍏�/鐏厜
 5376=搴旂敤
+5377=娌℃湁鑷姩鍖杮\r\n} 璇风偣鍑诲彸涓婅娣诲姞
 
 
 
diff --git a/ZigbeeApp/Shared/Common/Logic.cs b/ZigbeeApp/Shared/Common/Logic.cs
old mode 100755
new mode 100644
index 4fe1ac6..42c01e0
--- a/ZigbeeApp/Shared/Common/Logic.cs
+++ b/ZigbeeApp/Shared/Common/Logic.cs
@@ -46,7 +46,7 @@
         /// <summary>
         /// 鎺ㄩ�佸唴瀹�
         /// </summary>
-        public string LogicCustomPushText;
+        public string LogicCustomPushText=string.Empty;
 
         //public Dictionary<string, string> TimeAttribute = new Dictionary<string, string>();
         public TimeAttributeObj TimeAttribute = new TimeAttributeObj();
diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 49660bf..6122be0 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -1747,8 +1747,7 @@
         /// </summary>
         private  void ShowAutotion()
         {
-
-            functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
+           // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            
             var bjFrameLayout = new FrameLayout
             {
@@ -1809,14 +1808,13 @@
             var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout
             {
                 Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30),
-                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+                //BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,/
                 X = Application.GetRealWidth(58),
-                //Radius = (uint)Application.GetRealHeight(50),
                 Y = scenehorizontalScrol.Bottom,
             };
             functionSceneAutoBodyView.AddChidren(logicScrolView);
             logicScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
-
+            bool no = false;
             recommendswitchBtn.MouseUpEventHandler += (sender, e) =>
             {
                 int Yheight = 0;
@@ -1824,6 +1822,7 @@
                 scenehorizontalScrol.RemoveAll();
                 if (recommendswitchBtn.IsSelected)
                 {
+                    no = true;
                     scenehorizontalScrol.Height = Application.GetRealHeight(246);
                     Yheight = 20;
                     for (int i = 1; i < 4; i++)
@@ -1899,30 +1898,31 @@
                 }
                 else
                 {
+                    no = false;
                     scenehorizontalScrol.Height = Application.GetRealHeight(0);
                     Yheight = 0;
                 }
                 logicScrolView.Y = scenehorizontalScrol.Bottom + Yheight;
                 logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight;
-                Automationview(logicScrolView);
+                Automationview(logicScrolView,no);
             };
             logicScrolView.BeginHeaderRefreshingAction += () =>
             {
                 //閲嶆柊鍒锋柊logic鍒楄〃
                 Common.Logic.LogicList.Clear();
-                Read(logicScrolView);
+                Read(logicScrolView,no);
                 //鍏抽棴鍒锋柊View锛�
                 logicScrolView.EndHeaderRefreshing();
             };
            
-            Read(logicScrolView);
+            Read(logicScrolView,no);
 
         }
         /// <summary>
         /// 璇诲彇鑷姩鍖栧垪琛ㄦ暟鎹紱
         /// </summary>
         /// <param name="logicScrolView"></param>
-        private async void Read(VerticalRefreshLayout logicScrolView)
+        private async void Read(VerticalRefreshLayout logicScrolView,bool no)
         {
             CommonPage.Loading.Start();
             if (Common.Logic.LogicList.Count == 0)
@@ -1944,17 +1944,66 @@
                 }
             }
             //鑷姩鍖�
-            Automationview(logicScrolView);
+            Automationview(logicScrolView,no);
             CommonPage.Loading.Hide();
-
         }
         /// <summary>
         /// 鍔犺浇鑷姩鍖栧垪琛ㄧ晫闈�
         /// </summary>
         /// <param name="refresview">Refresview.</param>
-        private async void Automationview(VerticalRefreshLayout refresview)
+        private async void Automationview(VerticalRefreshLayout refresview,bool no)
         {
             refresview.RemoveAll();
+            if (Common.Logic.LogicList.Count == 0&&no==false)
+            {
+                //灏辨槸涓轰簡鏄剧ず寮曞娣诲姞鍥炬爣;
+                refresview.BackgroundColor = 0x00000000;
+                var noFrameLayout = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(434+ 200+32+160),
+                    //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                };
+                refresview.AddChidren(noFrameLayout);
+
+
+                var noIconBtn = new Button
+                {
+                    Y=Application.GetRealHeight(160),
+                    Width = Application.GetMinRealAverage(756),
+                    Height = Application.GetMinRealAverage(434),
+                    UnSelectedImagePath = "Item/NoFunction.png",
+                    X = Application.GetRealWidth(104),
+                };
+                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.automationaddtext).Replace("{\\r\\n}", "\r\n"),
+                    TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
+                    TextAlignment = TextAlignment.Center,
+                    IsMoreLines = true,
+                    X = Application.GetRealWidth(190-58),
+                };
+                noFrameLayout.AddChidren(noTextBtn);
+
+            }
+            else
+            {
+
+                if (Common.Logic.LogicList.Count == 0 && no == true)
+                {
+                    ///鏀瑰彉婊戝姩view鐨勯鑹诧紱
+                    refresview.BackgroundColor = 0x00000000;
+                }
+                else
+                {
+                    refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
+                }
+            }
             foreach (var logic in Common.Logic.LogicList)
             {
 
@@ -2039,7 +2088,7 @@
                     var logicCommunalPage = new Logic.LogicCommunalPage();
                     HomePage.Instance.AddChidren(logicCommunalPage);
                     HomePage.Instance.PageIndex += 1;
-                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview); });
+                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview,no); });
 
                 };
 
@@ -2061,7 +2110,7 @@
                         if (e1)
                         {
                             Common.Logic.LogicList.Remove(logic);
-                            Automationview(refresview);
+                            Automationview(refresview,no);
                             Logic.Send.DelLogic(logic.LogicId);
                         }
                     };
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
index d5d36c0..7751fe6 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
@@ -445,7 +445,7 @@
             #endregion
 
 
-            #region  ----鍦ㄥ甯冮槻 绂诲甯冮槻  鎾ら槻
+            #region  ----鍦ㄥ甯冮槻 绂诲甯冮槻  鎾ら槻 鑳佽揩鎾ら槻
 
             #region  鍦ㄥ甯冮槻
 
@@ -577,7 +577,7 @@
             var urgentwithdrawalSelected = new SelectedButton();
             urgentwithdrawalRowLayout.AddChidren(urgentwithdrawalSelected);
             #endregion
-            #region  ----鍦ㄥ甯冮槻 绂诲甯冮槻  鎾ら槻鐐瑰嚮浜嬩欢
+            #region  ----鍦ㄥ甯冮槻 绂诲甯冮槻  鎾ら槻 鑳佽揩鎾ら槻鐐瑰嚮浜嬩欢
             ///鍦ㄥ甯冮槻鐐瑰嚮浜嬩欢
             EventHandler<MouseEventArgs> athomeclick = (sedner14, e14) =>
             {
@@ -850,8 +850,8 @@
             typeRow.AddChidren(Btncomplete);
             #endregion
 
-            #region  ------鍦ㄥ   绂诲  
-             #region ------鍦ㄥ
+            #region  ------鍒拌揪鍦扮偣   绂诲紑鍦扮偣  
+            #region ------鍒拌揪鍦扮偣
 
             var athomeFrameLayout = new FrameLayout
             {
@@ -885,7 +885,7 @@
             athomeRowLayout.AddChidren(athomeSelected);
             #endregion
 
-            #region -------绂诲 
+            #region -------绂诲紑鍦扮偣 
             var leavehomeFrameLayout = new FrameLayout
             {
                 Height = Application.GetRealHeight(160),
@@ -918,7 +918,7 @@
 
             #endregion
             string strname = "";
-            ///鍦ㄥ鐐瑰嚮浜嬩欢
+            ///鍒拌揪鍦扮偣鐐瑰嚮浜嬩欢
             EventHandler<MouseEventArgs> athomeclick = (sedner15, e15) =>
             {
                 strname = btnathome.Text;
@@ -934,7 +934,7 @@
             athomeRowLayout.MouseUpEventHandler += athomeclick;
             athomeFrameLayout.MouseUpEventHandler += athomeclick;
 
-            ///绂诲鐐瑰嚮浜嬩欢
+            ///绂诲紑鍦扮偣鐐瑰嚮浜嬩欢
             EventHandler<MouseEventArgs> leavehomeclick = (sedner14, e14) =>
             {
                 strname = btnleavehome.Text;
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs b/ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs
index 3ad9a3d..6c565cfc 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs
@@ -107,6 +107,7 @@
                  {
                      ///鍙敼鎺ㄩ�佸唴瀹癸紱
                      Send.LogicControlSwitch(Common.Logic.CurrentLogic);
+                     Send.Data("娣诲姞/鏇存柊", "/App/HomeLogicConfig", "POST");
                  }
                  RemoveFromParent();
 
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs
index 257b69c..cc4974c 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs
@@ -200,6 +200,7 @@
                 BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
                 TextID = MyInternationalizationString.Save,
                 TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
+                TextSize=16,
             };
             PickerViewfra.AddChidren(btnsave);
 
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
index f1a9a25..117357f 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
@@ -114,25 +114,27 @@
                 }
             }
             CommonPage.Loading.Start();
-            if (!d)
+            middle.RemoveAll();
+            System.Threading.Tasks.Task.Run(async () =>
             {
-
-                CommonPage.Loading.Start();
-                new System.Threading.Thread(async () =>
+                try
                 {
-                    var allMemberslist = await Send.AllMembers(macport);
-                    Send.LockList.AddRange(allMemberslist);
+                    if (!d)
+                    {
+                        var allMemberslist = await Send.AllMembers(macport);
+                        Send.LockList.AddRange(allMemberslist);
+                    }
+                }
+                catch { }
+                finally
+                {
                     Application.RunOnMainThread(() =>
                     {
                         CommonPage.Loading.Hide();
+                        UserAllView(macport);
                     });
-                })
-                { IsBackground = true }.Start();
-
-            }
-            UserAllView(macport);
-            CommonPage.Loading.Hide();
-
+                }
+            });
         }
         /// <summary>
         /// 鏄剧ず鎵�鏈夌敤鎴�
@@ -278,86 +280,183 @@
             };
             lockRow.AddChidren(Btncomplete);
             #endregion
-
+            bool @false = false;
+            if (membershipIfon.UserIdMode.Count > 10)
+            {
+                @false = false;//
+                lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * 10) - 20 - 50);
+                lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * 10) + 20 + 50);
+            }
+            else
+            {
+                @false = false;
+                lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.UserIdMode.Count) - 20 - 50);
+                lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.UserIdMode.Count) + 20 + 50);
+            }
             string SelectedLockStatus = "";
-            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 = "";
             string attriButeData2 = "";
             string modeName = "";
-            for (int j = 0; j < membershipIfon.UserIdMode.Count; j++)
+            if (!@false)
             {
-                var userIdmode = membershipIfon.UserIdMode[j];
-                var doorlockfra = new FrameLayout
+                for (int j = 0; j < membershipIfon.UserIdMode.Count; j++)
                 {
-                    Height = Application.GetRealHeight(160),
-                    Y = lockRow.Bottom + Application.GetRealHeight(20 + 160 * j),
-                };
-                lockcolorfra1.AddChidren(doorlockfra);
-
-                var doorlockRow = new RowLayout
-                {
-                    Y = Application.GetRealHeight(30),
-                    Width = Application.GetRealWidth(920),
-                    Height = Application.GetRealHeight(130),
-                    X = Application.GetRealWidth(80),
-                    LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-                };
-                doorlockfra.AddChidren(doorlockRow);
-
-                var doorlockBtn = new Button
-                {
-                    Width = Application.GetRealWidth(600),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
-                    Text = userIdmode.ModeName,
-                    TextSize = 14,
-                };
-                doorlockRow.AddChidren(doorlockBtn);
-
-                var doorlockSelected = new Button
-                {
-                    X = Application.GetRealWidth(860),
-                    Width = Application.GetMinRealAverage(60),
-                    Height = Application.GetMinRealAverage(60),
-                    UnSelectedImagePath = "ZigeeLogic/selected.png",
-                    Visible = false,
-                    Gravity = Gravity.CenterVertical,
-
-                };
-                doorlockRow.AddChidren(doorlockSelected);
-                if ((membershipIfon.UserIdMode.Count - 1) == j)
-                {
-                    doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
-                }
-                EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) =>
-                {
-                    SelectedLockStatus = "DoorLock";
-                    selectedIcon.Visible = false;
-                    selectedIcon = doorlockSelected;
-                    doorlockSelected.Visible = true;
-                    //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
-                    attriButeId = userIdmode.OpenMode.ToString();
-                    attriButeData2 = userIdmode.UserId;
-                    modeName = userIdmode.ModeName;
-                };
-                doorlockRow.MouseUpEventHandler += doorlockclick;
-                doorlockBtn.MouseUpEventHandler += doorlockclick;
-                doorlockSelected.MouseUpEventHandler += doorlockclick;
-                doorlockfra.MouseUpEventHandler += doorlockclick;
-                ///鏄剧ず涔嬪墠鐨勭姸鎬�
-                if (conditionsIndex != -1)
-                {
-                    var s = Common.Logic.CurrentLogic.Conditions[conditionsIndex];
-                    if (s["AttriButeId"] == userIdmode.OpenMode.ToString() && s["AttriButeData2"] == userIdmode.UserId)
+                    var userIdmode = membershipIfon.UserIdMode[j];
+                    var doorlockfra = new FrameLayout
                     {
+                        Height = Application.GetRealHeight(160),
+                        Y = lockRow.Bottom + Application.GetRealHeight(20 + 160 * j),
+                    };
+                    lockcolorfra1.AddChidren(doorlockfra);
+
+                    var doorlockRow = new RowLayout
+                    {
+                        Y = Application.GetRealHeight(30),
+                        Width = Application.GetRealWidth(920),
+                        Height = Application.GetRealHeight(130),
+                        X = Application.GetRealWidth(80),
+                        LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                    };
+                    doorlockfra.AddChidren(doorlockRow);
+
+                    var doorlockBtn = new Button
+                    {
+                        Width = Application.GetRealWidth(600),
+                        TextAlignment = TextAlignment.CenterLeft,
+                        TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
+                        Text = userIdmode.ModeName,
+                        TextSize = 14,
+                    };
+                    doorlockRow.AddChidren(doorlockBtn);
+
+                    var doorlockSelected = new Button
+                    {
+                        X = Application.GetRealWidth(860),
+                        Width = Application.GetMinRealAverage(60),
+                        Height = Application.GetMinRealAverage(60),
+                        UnSelectedImagePath = "ZigeeLogic/selected.png",
+                        Visible = false,
+                        Gravity = Gravity.CenterVertical,
+
+                    };
+                    doorlockRow.AddChidren(doorlockSelected);
+                    if ((membershipIfon.UserIdMode.Count - 1) == j)
+                    {
+                        doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
+                    }
+                    EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) =>
+                    {
+                        SelectedLockStatus = "DoorLock";
                         selectedIcon.Visible = false;
                         selectedIcon = doorlockSelected;
                         doorlockSelected.Visible = true;
+                    //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                    attriButeId = userIdmode.OpenMode.ToString();
+                        attriButeData2 = userIdmode.UserId;
+                        modeName = userIdmode.ModeName;
+                    };
+                    doorlockRow.MouseUpEventHandler += doorlockclick;
+                    doorlockBtn.MouseUpEventHandler += doorlockclick;
+                    doorlockSelected.MouseUpEventHandler += doorlockclick;
+                    doorlockfra.MouseUpEventHandler += doorlockclick;
+                    ///鏄剧ず涔嬪墠鐨勭姸鎬�
+                    if (conditionsIndex != -1)
+                    {
+                        var s = Common.Logic.CurrentLogic.Conditions[conditionsIndex];
+                        if (s["AttriButeId"] == userIdmode.OpenMode.ToString() && s["AttriButeData2"] == userIdmode.UserId)
+                        {
+                            selectedIcon.Visible = false;
+                            selectedIcon = doorlockSelected;
+                            doorlockSelected.Visible = true;
+                        }
+
+
                     }
+                }
+            }
+            else
+            {
+                for (int j = 0; j < membershipIfon.UserIdMode.Count; j++)
+                {
+                    var userIdmode = membershipIfon.UserIdMode[j];
+
+                    var vv = new VerticalScrolViewLayout
+                    {
+                        Height = Application.GetRealHeight(160 * 8),
+                        Y = lockRow.Bottom,
+                    };
+                    lockcolorfra1.AddChidren(vv);
+                    var doorlockfra = new FrameLayout
+                    {
+                        Height = Application.GetRealHeight(160),
+                        Y = Application.GetRealHeight(160 * j),
+                    };
+                    vv.AddChidren(doorlockfra);
+
+                    var doorlockRow = new RowLayout
+                    {
+                        Y = Application.GetRealHeight(30),
+                        Width = Application.GetRealWidth(920),
+                        Height = Application.GetRealHeight(130),
+                        X = Application.GetRealWidth(80),
+                        LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                    };
+                    doorlockfra.AddChidren(doorlockRow);
+
+                    var doorlockBtn = new Button
+                    {
+                        Width = Application.GetRealWidth(600),
+                        TextAlignment = TextAlignment.CenterLeft,
+                        TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
+                        Text = userIdmode.ModeName,
+                        TextSize = 14,
+                    };
+                    doorlockRow.AddChidren(doorlockBtn);
+
+                    var doorlockSelected = new Button
+                    {
+                        X = Application.GetRealWidth(860),
+                        Width = Application.GetMinRealAverage(60),
+                        Height = Application.GetMinRealAverage(60),
+                        UnSelectedImagePath = "ZigeeLogic/selected.png",
+                        Visible = false,
+                        Gravity = Gravity.CenterVertical,
+
+                    };
+                    doorlockRow.AddChidren(doorlockSelected);
+                    if ((membershipIfon.UserIdMode.Count - 1) == j)
+                    {
+                        doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor;
+                    }
+                    EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) =>
+                    {
+                        SelectedLockStatus = "DoorLock";
+                        selectedIcon.Visible = false;
+                        selectedIcon = doorlockSelected;
+                        doorlockSelected.Visible = true;
+                    //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                    attriButeId = userIdmode.OpenMode.ToString();
+                        attriButeData2 = userIdmode.UserId;
+                        modeName = userIdmode.ModeName;
+                    };
+                    doorlockRow.MouseUpEventHandler += doorlockclick;
+                    doorlockBtn.MouseUpEventHandler += doorlockclick;
+                    doorlockSelected.MouseUpEventHandler += doorlockclick;
+                    doorlockfra.MouseUpEventHandler += doorlockclick;
+                    ///鏄剧ず涔嬪墠鐨勭姸鎬�
+                    if (conditionsIndex != -1)
+                    {
+                        var s = Common.Logic.CurrentLogic.Conditions[conditionsIndex];
+                        if (s["AttriButeId"] == userIdmode.OpenMode.ToString() && s["AttriButeData2"] == userIdmode.UserId)
+                        {
+                            selectedIcon.Visible = false;
+                            selectedIcon = doorlockSelected;
+                            doorlockSelected.Visible = true;
+                        }
 
 
+                    }
                 }
             }
 
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
index c5c855c..e4fcfca 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
@@ -1064,20 +1064,32 @@
 
             #endregion
 
+            bool tag = false;//鏍囪寮�鍏崇姸鎬�;
             btnswitch.MouseUpEventHandler += (sender1, e1) =>
             {
                 btnswitch.IsSelected = !btnswitch.IsSelected;
                 if (btnswitch.IsSelected)
                 {
+                    tag = true;
                     custompushFrameLayout.Height = Application.GetRealHeight(160);
+                    if (Common.Logic.CurrentLogic.LogicId != 0)
+                    {
+                        Send.Data("娣诲姞/鏇存柊", "/App/HomeLogicConfig", "POST");
+                    }
+
                 }
                 else
                 {
+                    tag = false;
                     custompushFrameLayout.Height = Application.GetRealHeight(0);
+                    if (Common.Logic.CurrentLogic.LogicId != 0)
+                    {
+                        Send.Data("鍒犻櫎", "/App/DelHomeLogicConfig", "POST");
+                    }
+
                 }
             };
 
-         
             var saveFrameLayout = new FrameLayout
             {
                 Y = middle.Bottom,
@@ -1106,12 +1118,12 @@
                     new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).Show();
                     return;
                 }
-                var logicname = Common.Logic.LockLogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
-                if (logicname != null)
-                {
-                    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
-                    return;
-                }
+                //var logicname = Common.Logic.LockLogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
+                //if (logicname != null)
+                //{
+                //    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
+                //    return;
+                //}
 
                 Common.Logic.CurrentLogic.LogicName = name;
 
@@ -1125,6 +1137,10 @@
                     {
                         Common.Logic.CurrentLogic.LogicId = logicifon.LogicId;
                         Common.Logic.LockLogicList.Add(Common.Logic.CurrentLogic);
+                        if (tag)
+                        {
+                            Send.Data("娣诲姞/鏇存柊", "/App/HomeLogicConfig", "POST");
+                        }
                     }
                 }
                 else
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
index 81eb56e..7c00eb6 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
@@ -154,6 +154,43 @@
         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.automationaddtext).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];
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index facfe17..8070799 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -975,7 +975,7 @@
                                 conditionIcon.UnSelectedImagePath = "ZigeeLogic/position.png";
                                 var btnlocation = new Button
                                 {
-                                    Width = Application.GetRealWidth(700),
+                                    Width = Application.GetRealWidth(250),
                                     TextAlignment = TextAlignment.CenterLeft,
                                     Gravity = Gravity.CenterVertical,
                                     TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
@@ -1002,11 +1002,11 @@
 
                                 var locationstatus = new Button
                                 {
-                                    Width = Application.GetRealWidth(300),
+                                    Width = Application.GetRealWidth(550),
                                     Height = Application.GetRealHeight(130),
                                     Gravity = Gravity.CenterVertical,
                                     TextAlignment = TextAlignment.CenterRight,
-                                    X = Application.GetRealWidth(500),
+                                    X = Application.GetRealWidth(250),
                                     TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                     TextSize = 14,
                                 };
@@ -1986,18 +1986,31 @@
             btncustompush.MouseUpEventHandler += customclick;
             custompushback.MouseUpEventHandler += customclick;
             custompushRowLayout.MouseUpEventHandler += customclick;
+            bool tag = false;//鏍囪寮�鍏崇姸鎬�;
             btnswitch.MouseUpEventHandler += (sender1, e1) =>
-            {
-                btnswitch.IsSelected = !btnswitch.IsSelected;
-                if (btnswitch.IsSelected)
-                {
-                    custompushFrameLayout.Height = Application.GetRealHeight(160);
-                }
-                else
-                {
-                    custompushFrameLayout.Height = Application.GetRealHeight(0);
-                }
-            };
+              {
+                  btnswitch.IsSelected = !btnswitch.IsSelected;
+                  if (btnswitch.IsSelected)
+                  {
+                      tag = true;
+                      custompushFrameLayout.Height = Application.GetRealHeight(160);
+                      if (Common.Logic.CurrentLogic.LogicId != 0)
+                      {
+                          Send.Data("娣诲姞/鏇存柊", "/App/HomeLogicConfig", "POST");
+                      }
+
+                  }
+                  else
+                  {
+                      tag = false;
+                      custompushFrameLayout.Height = Application.GetRealHeight(0);
+                      if (Common.Logic.CurrentLogic.LogicId != 0)
+                      {
+                          Send.Data("鍒犻櫎", "/App/DelHomeLogicConfig", "POST");
+                      }
+                      
+                  }
+              };
             #endregion
 
 
@@ -2010,12 +2023,13 @@
                     new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).Show();
                     return;
                 }
-                var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
-                if (logicname != null)
-                {
-                    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
-                    return;
-                }
+                ///鍏堥殣钘忓垽鏂悕瀛楃浉鍚岀殑鍔熻兘锛�
+                //var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
+                //if (logicname != null)
+                //{
+                //    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
+                //    return;
+                //}
 
                 Common.Logic.CurrentLogic.LogicName = name;
                 bool succeed = false;
@@ -2030,6 +2044,10 @@
                         succeed = true;
                         Common.Logic.CurrentLogic.LogicId = logicifon.LogicId;
                         Common.Logic.LogicList.Add(Common.Logic.CurrentLogic);
+                        if (tag)
+                        {
+                            Send.Data("娣诲姞/鏇存柊", "/App/HomeLogicConfig", "POST");
+                        }
                     }
                 }
                 else
@@ -2589,5 +2607,9 @@
             { IsBackground = true }.Start();
 
         }
+
+
+      
+
     }
 }
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
index de49765..a322a5f 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
@@ -119,21 +119,29 @@
                 }
 
             }
-            if (!d)
-            {
-                CommonPage.Loading.Start();
-                new System.Threading.Thread(async () =>
-                {
-                    var allMemberslist = await Send.AllMembers(macport);
-                    Send.LockList.AddRange(allMemberslist);
-                    Application.RunOnMainThread(() =>
-                    {
-                        CommonPage.Loading.Hide();
-                    });
-                })
-                { IsBackground = true }.Start();
-            }
-            UserList(macport);
+
+            CommonPage.Loading.Start();
+            middle.RemoveAll();
+            System.Threading.Tasks.Task.Run(async () =>
+           {
+               try
+               {
+                   if (!d)
+                   {
+                       var allMemberslist = await Send.AllMembers(macport);
+                       Send.LockList.AddRange(allMemberslist);
+                   }
+               }
+               catch { }
+               finally
+               {
+                   Application.RunOnMainThread(() =>
+                   {
+                       CommonPage.Loading.Hide();
+                       UserList(macport);
+                   });
+               }
+           });
         }
         /// <summary>
         /// 鎴愬憳鍒楄〃鐨勬柟娉�
@@ -141,7 +149,6 @@
         /// <param name="macport"></param>
         public void UserList(string macport)
         {
-            middle.RemoveAll();
             foreach (var user in Send.LockList)
             {
                 if (user.DoorLockMacPort != macport)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs
index 9c96d7a..681e0e8 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs
@@ -87,6 +87,7 @@
                 BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
                 TextID = MyInternationalizationString.Save,
                 TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
+                TextSize=16,
 
             };
             middle.AddChidren(btnsave);
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
index ab23f9e..63cc505 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
@@ -5,6 +5,8 @@
 using ZigBee.Common;
 using Shared.Common;
 using System.Collections.Specialized;
+using System.Net;
+using System.IO;
 
 namespace Shared.Phone.Device.Logic
 {
@@ -1008,45 +1010,15 @@
             return await WebClientAsync(2, lockifon.Url, lockifon);
         }
 
-        /// <summary>
-        /// 璇锋眰鏈嶅姟鍣ㄧ殑鏂规硶
-        /// </summary>
-        /// <param name="postValues">post鍙傛暟</param>
-        /// <param name="url"></param>
-        /// <returns></returns>
-        public static async System.Threading.Tasks.Task<string> WebClientAsync(int value, string url, Residential residential = null)
+              //鎵撳嵃NameValueCollection()鏄剧ず绱㈠紩, 閿�,鍊�    
+        public static void PrintKeysAndValues2(NameValueCollection myCol)
         {
-            NameValueCollection postValues = new NameValueCollection();
-
-            if (value == 0)
+            for (int i = 0; i < myCol.Count; i++)
             {
-                postValues.Add("RequestVersion", CommonPage.RequestVersion);
-                postValues.Add("ReqDto.LoginAccessToken", Config.Instance.Token);
-                postValues.Add("ReqDto.PageSetting.PageSize", Int32.MaxValue.ToString());//
-
+                //鎵撳嵃鏄剧ず绱㈠紩, 閿�,鍊�  
+                Console.WriteLine("[{0}]{1,-10} {2}", i, myCol.GetKey(i), myCol.Get(i));
             }
-            else if (value == 1)
-            {
-                postValues.Add("RequestVersion", CommonPage.RequestVersion);
-                postValues.Add("LoginAccessToken", Config.Instance.Token);
-                postValues.Add("MainAccountId", residential.MainUserDistributedMark);
-                postValues.Add("SharedHid", residential.Id);
-            }
-            else if (value == 2)
-            {
-                postValues.Add("RequestVersion", CommonPage.RequestVersion);
-                postValues.Add("LoginAccessToken", residential.Token);
-                postValues.Add("HomeId", residential.Id);
-                postValues.Add("DoorLockId", residential.doorlockmac);//闂ㄩ攣Mac+绔彛
-                postValues.Add("IsOtherAccountCtrl", residential.IsOtherAccountCtrl.ToString());
-                postValues.Add("PageSetting.PageSize", Int32.MaxValue.ToString());
-            }
-            System.Net.WebClient webClient = new System.Net.WebClient();
-            byte[] responseArray = webClient.UploadValues(url, postValues);
-            var s = System.Text.Encoding.UTF8.GetString(responseArray);
-            return s;
         }
-        
         public class Residential
         {
             /// <summary>
@@ -1155,6 +1127,134 @@
         public static UserCenter.MemberInfoRes UserMemberInfoRes = null;
         #endregion
 
+        #region  璇锋眰鏈嶅姟鍣ㄦ柟娉�---
+        /// <summary>
+        /// 璇锋眰鏁版嵁鐨勫皝瑁呮柟娉�
+        /// </summary>
+        /// <param name="command">璇嗗埆鍛戒护鍒ゆ柇瀛楃涓�</param>
+        /// <param name="url">璇锋眰鍦板潃</param>
+        /// <param name="method">璇锋眰鏂瑰紡涓篜OST/GET</param>
+        /// <param name="obj">瀛樺偍鍙戦�佹暟鎹殑瀵硅薄</param>
+        /// <returns></returns>
+        public static async System.Threading.Tasks.Task<string>Data(string command, string url, string method, object obj = null)
+        {
+            var getUrl = CommonPage.RequestHttpsHost + url;//璇锋眰鍦板潃锛�
+            var jObject = new JObject();
+            if (UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 1)
+            {
+                jObject.Add("IsOtherAccountCtrl", false);
+            }
+            else
+            {
+                jObject.Add("IsOtherAccountCtrl", true);
+            }
+            switch (command)
+            {
+                case "娣诲姞/鏇存柊":
+                    {
+                        jObject.Add("RequestVersion", CommonPage.RequestVersion);
+                        jObject.Add("LoginAccessToken", Config.Instance.Token);
+                        jObject.Add("HomeId", Config.Instance.HomeId);
+                        jObject.Add("LogicID", Common.Logic.CurrentLogic.LogicId);
+                        jObject.Add("PushUserIds", new JArray { Config.Instance.Guid });
+                        jObject.Add("PushContent", Common.Logic.CurrentLogic.LogicCustomPushText);
+
+                    }
+                    break;
+                case "鍒犻櫎":
+                    {
+                        jObject.Add("RequestVersion", CommonPage.RequestVersion);
+                        jObject.Add("LoginAccessToken", Config.Instance.Token);
+                        jObject.Add("HomeId", Config.Instance.HomeId);
+                        jObject.Add("LogicID", Common.Logic.CurrentLogic.LogicId);
+                    }
+                    break;
+            }
+            return await HttpWebRequest(getUrl, jObject.ToString(), method);
+        }
+        /// <summary>
+        ///  璇锋眰鏈嶅姟鍣ㄧ殑鏂规硶(鏀寔璇锋眰鏂瑰紡涓篜OST/GET)
+        /// </summary>
+        /// <param name="getUrl">璇锋眰鐨勫湴鍧�</param>
+        /// <param name="str">璇锋眰鏁版嵁</param>
+        /// <param name="method">璇锋眰鏂瑰紡涓篜OST/GET</param>
+        /// <param name="second">瓒呮椂鏃堕棿</param>
+        /// <returns></returns>
+        public static async System.Threading.Tasks.Task<string>HttpWebRequest(string getUrl, string str, string method,int second= 3)
+        {
+            HttpWebRequest request = WebRequest.Create(getUrl) as HttpWebRequest; //鍒涘缓璇锋眰
+            request.Method = method; //璇锋眰鏂瑰紡涓篜OST/GET
+            request.ContentType = "application/json";
+            request.Timeout = second * 1000;//瓒呮椂鏃堕棿
+            if (method == "POST")
+            {
+                byte[] jsonbyte = System.Text.Encoding.UTF8.GetBytes(str);
+                request.ContentLength = jsonbyte.Length;
+                Stream postStream = request.GetRequestStream();
+                postStream.Write(jsonbyte, 0, jsonbyte.Length);
+                postStream.Close();
+            }
+            //鍙戦�佽姹傚苟鑾峰彇鐩稿簲鍥炲簲鏁版嵁       
+            HttpWebResponse res;
+            try
+            {
+                res = (HttpWebResponse)request.GetResponse();
+            }
+            catch (WebException ex)
+            {
+                res = (HttpWebResponse)ex.Response;
+            }
+            StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.UTF8);
+            string content = sr.ReadToEnd(); //鑾峰緱鍝嶅簲瀛楃涓�
+            return content;
+        }
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣ㄧ殑鏂规硶
+        /// </summary>
+        /// <param name="value">鍖哄垎鍙戦�佸懡浠ょ殑鏁版嵁鍒ゆ柇鍊�</param>
+        /// <param name="url">璇锋眰鐨勫湴鍧�</param>
+        /// <param name="residential">瑁呮暟鎹殑瀵硅薄</param>
+        /// <returns></returns>
+        public static async System.Threading.Tasks.Task<string> WebClientAsync(int value, string url, Residential residential = null)
+        {
+            NameValueCollection postValues = new NameValueCollection();
+            switch (value)
+            {
+                case 0:
+                    {
+                        postValues.Add("RequestVersion", CommonPage.RequestVersion);
+                        postValues.Add("ReqDto.LoginAccessToken", Config.Instance.Token);
+                        postValues.Add("ReqDto.PageSetting.PageSize", Int32.MaxValue.ToString());//
+                    }
+                    break;
+                case 1:
+                    {
+                        postValues.Add("RequestVersion", CommonPage.RequestVersion);
+                        postValues.Add("LoginAccessToken", Config.Instance.Token);
+                        postValues.Add("MainAccountId", residential.MainUserDistributedMark);
+                        postValues.Add("SharedHid", residential.Id);
+
+                    }
+                    break;
+                case 2:
+                    {
+                        postValues.Add("RequestVersion", CommonPage.RequestVersion);
+                        postValues.Add("LoginAccessToken", residential.Token);
+                        postValues.Add("HomeId", residential.Id);
+                        postValues.Add("DoorLockId", residential.doorlockmac);//闂ㄩ攣Mac+绔彛
+                        postValues.Add("IsOtherAccountCtrl", residential.IsOtherAccountCtrl.ToString());
+                        postValues.Add("PageSetting.PageSize", Int32.MaxValue.ToString());
+                    }
+                    break;
+            }
+            //PrintKeysAndValues2(postValues);
+            System.Net.WebClient webClient = new System.Net.WebClient();
+            byte[] responseArray = webClient.UploadValues(url, postValues);
+            var s = System.Text.Encoding.UTF8.GetString(responseArray);
+            return s;
+        }
+        #endregion
+
         #region  瀛樺彇鏈湴鏂囦欢鐨勬柟娉� ---鏆傛椂涓嶇敤鍚堝苟璇ユ柟娉�---
         /// <summary>
         /// 鏂囦欢淇濆瓨
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs
index 0bb6882..78ee519 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs
@@ -109,7 +109,7 @@
                 Height = Application.GetRealHeight(436),
                 X = Application.GetRealWidth(72),
                 Y = Application.GetRealHeight(30),
-                UnSelectedImagePath = "ZigeeLogic/logicbj" + s + ".png",
+                UnSelectedImagePath = $"ZigeeLogic/logicbj{s}.png",
             };
             logiciconfl.AddChidren(iconBtn);
 
@@ -298,11 +298,11 @@
                     var addtextbtn = new Button
                     {
                         Height = Application.GetRealHeight(58),
-                        Width = Application.GetRealWidth(300),
+                        Width = Application.GetRealWidth(400),
                         Y = Application.GetRealHeight(45 + 30),
                         TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                         TextID = MyInternationalizationString.addsensor,
-                        X = Application.GetRealWidth(390),
+                        X = Application.GetRealWidth(340),
                         TextSize = 14,
                     };
                     addfl.AddChidren(addtextbtn);
@@ -612,11 +612,11 @@
                     var addtextbtn = new Button
                     {
                         Height = Application.GetRealHeight(58),
-                        Width = Application.GetRealWidth(300),
+                        Width = Application.GetRealWidth(400),
                         Y = Application.GetRealHeight(45 + 30),
                         TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                         TextID = MyInternationalizationString.addlighting,
-                        X = Application.GetRealWidth(390),
+                        X = Application.GetRealWidth(340),
                         TextSize = 14,
                     };
                     addfl.AddChidren(addtextbtn);
@@ -1195,16 +1195,29 @@
 
             #endregion
 
+            bool tag = false;//鏍囪寮�鍏崇姸鎬�;
             btnswitch.MouseUpEventHandler += (sender1, e1) =>
             {
                 btnswitch.IsSelected = !btnswitch.IsSelected;
                 if (btnswitch.IsSelected)
                 {
+                    tag = true;
                     custompushFrameLayout.Height = Application.GetRealHeight(160);
+                    if (Common.Logic.CurrentLogic.LogicId != 0)
+                    {
+                        Send.Data("娣诲姞/鏇存柊", "/App/HomeLogicConfig", "POST");
+                    }
+
                 }
                 else
                 {
+                    tag = false;
                     custompushFrameLayout.Height = Application.GetRealHeight(0);
+                    if (Common.Logic.CurrentLogic.LogicId != 0)
+                    {
+                        Send.Data("鍒犻櫎", "/App/DelHomeLogicConfig", "POST");
+                    }
+
                 }
             };
             var saveFrameLayout = new FrameLayout
@@ -1238,12 +1251,12 @@
                     new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).Show();
                     return;
                 }
-                var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
-                if (logicname != null)
-                {
-                    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
-                    return;
-                }
+                //var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
+                //if (logicname != null)
+                //{
+                //    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
+                //    return;
+                //}
 
                 Common.Logic.CurrentLogic.LogicName = name;
 
@@ -1257,6 +1270,10 @@
                     {
                         Common.Logic.CurrentLogic.LogicId = logicifon.LogicId;
                         Common.Logic.LogicList.Add(Common.Logic.CurrentLogic);
+                        if (tag)
+                        {
+                            Send.Data("娣诲姞/鏇存柊", "/App/HomeLogicConfig", "POST");
+                        }
                     }
                 }
                 else
diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs
index 16a17fa..505ef83 100644
--- a/ZigbeeApp/Shared/R.cs
+++ b/ZigbeeApp/Shared/R.cs
@@ -581,6 +581,7 @@
         public readonly static int addsensor = 5374;
         public readonly static int addlighting = 5375;
         public readonly static int application = 5376;
+        public readonly static int automationaddtext = 5377;
 
         #region 鐧诲綍娉ㄥ唽
         /// <summary>

--
Gitblit v1.8.0