From 9c6bd67d66859e48f0e794cd2746aef9310ce71d Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期五, 13 十二月 2019 18:01:37 +0800
Subject: [PATCH] 2019-12-13-2

---
 ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs                 |   15 ++++++++++++---
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs |   12 +++++++++++-
 ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml                            |   12 ++++++------
 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs          |   15 ++++++++++++---
 4 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
index 5a507a3..db1f7b0 100644
--- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
+++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
@@ -1,12 +1,10 @@
 锘�<Properties StartupConfiguration="{F1296E2C-3777-4385-85B2-DA77617E3178}|Default">
   <MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.SelectDevice" />
   <MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.SelectDevice" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/LogicDevicePage.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/LogicCommunalPage.cs">
     <Files>
-      <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" Line="20" Column="31" />
-      <File FileName="Shared/Phone/Device/Logic/DeviceStateCondition.cs" Line="750" Column="59" />
-      <File FileName="Shared/Phone/Device/Logic/LogicDevicePage.cs" Line="2059" Column="53" />
-      <File FileName="Shared/Common/ZigbeeColor.cs" Line="315" Column="53" />
+      <File FileName="Shared/Phone/Device/Logic/Send.cs" Line="766" Column="70" />
+      <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" Line="1" Column="1" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
@@ -22,8 +20,9 @@
               <Node name="Common" expanded="True" />
               <Node name="Phone" expanded="True">
                 <Node name="Device" expanded="True">
+                  <Node name="Category" expanded="True" />
                   <Node name="Logic" expanded="True">
-                    <Node name="LogicDevicePage.cs" selected="True" />
+                    <Node name="LogicCommunalPage.cs" selected="True" />
                   </Node>
                 </Node>
                 <Node name="UserCenter" expanded="True">
@@ -31,6 +30,7 @@
                     <Node name="Bind" expanded="True" />
                   </Node>
                 </Node>
+                <Node name="UserView" expanded="True" />
                 <Node name="ZigBee" expanded="True">
                   <Node name="Device" expanded="True" />
                 </Node>
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
index d4470ad..570e43d 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs
@@ -94,7 +94,17 @@
                 //鍏抽棴鍒锋柊View锛�
                 middle.EndHeaderRefreshing();
             };
-            Read();
+            //Read();
+            CommonPage.Loading.Start();
+            new System.Threading.Thread(() =>
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    Read();
+                    CommonPage.Loading.Hide();
+                });
+            })
+            { IsBackground = true }.Start();
 
         }
         /// <summary>
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index bcfeb18..e10217c 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -1992,7 +1992,7 @@
                 }
 
                 Common.Logic.CurrentLogic.LogicName = name;
-
+                bool succeed = false;
                 //鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫
                 CommonPage.Loading.Start();
                 if (Common.Logic.CurrentLogic.LogicId == 0)
@@ -2001,6 +2001,7 @@
                     var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic);
                     if (logicifon != null && logicifon.LogicId != 0)
                     {
+                        succeed = true;
                         Common.Logic.CurrentLogic.LogicId = logicifon.LogicId;
                         Common.Logic.LogicList.Add(Common.Logic.CurrentLogic);
                     }
@@ -2008,10 +2009,18 @@
                 else
                 {
                     //鍙戦�佷慨鏀归�昏緫鍛戒护
-                    Send.AddModifyLogic(Common.Logic.CurrentLogic);
+                   var modlogic=Send.AddModifyLogic(Common.Logic.CurrentLogic);
+                    //缂栬緫榛樿鎴愬姛锛堜笉鑰冭檻缃戠粶鎯呭喌锛夛紱
+                    succeed = true;
                 }
-
                 CommonPage.Loading.Hide();
+
+                if (!succeed) {
+                    //缃戝叧鍥炲澶辫触锛屼笉鍏抽棴鐣岄潰锛岃瀹冨仠鐣欏綋鍓嶇晫闈紱
+                    //锛堝師鍥狅細鑰冭檻鍒板け璐ラ噸鏂扮紪杈戝師鏉ユ暟鎹粰鐢ㄦ埛甯︽潵浜嗛夯鐑︼級
+                    ///鎻愮ず锛氭坊鍔犺嚜鍔ㄥ寲澶辫触锛�
+                    return;
+                }
                 UserView.HomePage.Instance.RemoveViewByTag("Logic");
                 Category.Category.instance?.RefreshBodyView();
            
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
index c3b8852..c74aa34 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
@@ -99,7 +99,18 @@
                 //鍏抽棴鍒锋柊View锛�
                 middle.EndHeaderRefreshing();
             };
-            Read();
+            //Read();
+
+            CommonPage.Loading.Start();
+            new System.Threading.Thread(() =>
+           {
+               Application.RunOnMainThread(() =>
+               {
+                   Read();
+                   CommonPage.Loading.Hide();
+               });
+           })
+            { IsBackground = true }.Start();
         }
         /// <summary>
         /// 璇诲彇褰撳墠闂ㄩ攣鐨勪簯绔暟鎹紱
@@ -119,14 +130,12 @@
                 }
 
             }
-            CommonPage.Loading.Start();
             if (!d)
             {
                 var allMemberslist = await Send.AllMembers(common.DeviceAddr);
                 Send.LockList.AddRange(allMemberslist);
             }
             UserList(macport);
-            CommonPage.Loading.Hide();
         }
         /// <summary>
         /// 鎴愬憳鍒楄〃鐨勬柟娉�

--
Gitblit v1.8.0