From f23ad1b3f9f6193f35f72104d690b21dc67d5c1f Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 06 七月 2020 12:35:25 +0800
Subject: [PATCH] 去掉了访问外网的异步

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs |   67 ++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs
index 4244dad..4b0826e 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs
@@ -5,7 +5,6 @@
 using System.IO;
 using System.Net;
 using System.Text;
-using System.Threading.Tasks;
 using ZigBee.Device;
 
 namespace Shared.Phone.UserCenter
@@ -53,7 +52,7 @@
         /// </summary>
         /// <param name="listDistributedMark"></param>
         /// <returns></returns>
-        private async Task<List<string>> SetShardFileToLocation(List<string> listDistributedMark)
+        private List<string> SetShardFileToLocation(List<string> listDistributedMark)
         {
             if (listDistributedMark.Count == 0)
             {
@@ -73,8 +72,8 @@
             {
                 string keys = listDistributedMark[i];
                 var dataPra = new { DistributedMark = keys, HouseDistributedMark = Common.Config.Instance.Home.Id, IsOtherAccountControl = Common.Config.Instance.Home.IsOthreShare };
-                var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetOneShareData", false, dataPra);
-                if (result == null)
+                var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetOneShareData", false, dataPra, null, true);
+                if (string.IsNullOrEmpty(result) == true)
                 {
                     //鍏佽鎸夌郴缁熺殑杩斿洖閿�
                     Shared.Common.CommonPage.BackKeyCanClick = true;
@@ -239,7 +238,7 @@
         /// <summary>
         /// 鍚屾鏈嶅姟鍣ㄧ殑鍒嗕韩鍐呭(閲岄潰鍙礋璐f妸涓滆タ瀛樺叆鏈湴)
         /// </summary>
-        public async Task<bool> SynchronizeDbSharedContent()
+        public bool SynchronizeDbSharedContent()
         {
             if (UserCenterResourse.UserInfo.AuthorityNo != 3)
             {
@@ -249,8 +248,7 @@
 
             //鑾峰彇涓讳汉鍒嗕韩缁欐垚鍛樼殑鏂囦欢鍒楄〃
             var infoPra = new { DistributedMark = Config.Instance.Guid, HouseDistributedMark = Common.Config.Instance.Home.Id, IsOtherAccountControl = Common.Config.Instance.Home.IsOthreShare };
-            var listNotShow = new List<string>() { "NotSetAgain" };
-            var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra, listNotShow);
+            var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra);
             if (string.IsNullOrEmpty(result) == true)
             {
                 return false;
@@ -291,7 +289,7 @@
 
                 //灏嗗垎浜殑鏁版嵁瀛樺叆鏈湴(鑾峰彇鐨勬槸鏈湴娌℃湁鐨�)
                 this.ClearShardDirectory();
-                var listDbFile = await this.SetShardFileToLocation(listAddMark);
+                var listDbFile = this.SetShardFileToLocation(listAddMark);
                 if (listDbFile == null)
                 {
                     //鍏抽棴
@@ -317,7 +315,7 @@
             }
 
             //鍚屾鏈嶅姟鍣ㄧ殑鍙栨秷浜嗙殑鍒嗕韩鍐呭
-            return await this.SynchronizeDeleteSharedContent(listShardFile, dicUpdateTime);
+            return this.SynchronizeDeleteSharedContent(listShardFile, dicUpdateTime);
         }
 
         /// <summary>
@@ -326,7 +324,7 @@
         /// <param name="listShardFile">浜戠涓婇潰鍒嗕韩鐨勬枃浠�,涓篘ull鏃朵粠鏂拌幏鍙�</param>
         /// <param name="dicUpdateTime">鍒嗕韩鏂囦欢鐨勬洿鏂版椂闂�,涓篘ull鏃朵粠鏂拌幏鍙�</param>
         /// <returns></returns>
-        public async Task<bool> SynchronizeDeleteSharedContent(HashSet<string> listShardFile = null, Dictionary<string, string> dicUpdateTime = null)
+        public bool SynchronizeDeleteSharedContent(HashSet<string> listShardFile = null, Dictionary<string, string> dicUpdateTime = null)
         {
             if (UserCenterResourse.UserInfo.AuthorityNo != 3)
             {
@@ -349,8 +347,7 @@
                 listShardFile = new HashSet<string>();
                 //鑾峰彇涓讳汉鍒嗕韩缁欐垚鍛樼殑鏂囦欢鍒楄〃
                 var infoPra = new { DistributedMark = Config.Instance.Guid, HouseDistributedMark = Common.Config.Instance.Home.Id, IsOtherAccountControl = Common.Config.Instance.Home.IsOthreShare };
-                var listNotShow = new List<string>() { "NotSetAgain" };
-                var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra, listNotShow);
+                var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra);
                 if (string.IsNullOrEmpty(result) == true)
                 {
                     //鍏抽棴
@@ -487,7 +484,7 @@
         /// <para>New鐨勬椂鍊欒寰楀SubAccountDistributedMark璧嬪��,瀹冩槸鎴愬憳鍒楄〃鎺ュ彛杩斿洖鐨凷ubAccountDistributedMark</para>
         /// </param>
         /// <returns></returns>
-        public async Task<bool> GetMemberShardContentListAndSetToLocation(MemberShardInfoData memberShardInfo)
+        public bool GetMemberShardContentListAndSetToLocation(MemberShardInfoData memberShardInfo)
         {
             if (memberShardInfo.Refresh == false)
             {
@@ -507,8 +504,8 @@
                 HouseDistributedMark = Shared.Common.Config.Instance.HomeId,
                 IsOtherAccountControl = Common.Config.Instance.Home.IsOthreShare
             };
-            var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra);
-            if (result == null)
+            var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/GetShareDataBySubAccount", false, infoPra);
+            if (string.IsNullOrEmpty(result) == true)
             {
                 //鍏抽棴杩涘害鏉�
                 ProgressFormBar.Current.Close();
@@ -542,7 +539,7 @@
             }
 
             //灏嗗垎浜殑鏁版嵁瀛樺叆鏈湴,杩斿洖鐨勬槸鏂囦欢鍚嶅瓧(寮傚父鏃惰繑鍥瀗ull)
-            var listFile = await this.SetShardFileToLocation(listMark);
+            var listFile = this.SetShardFileToLocation(listMark);
             if (listFile == null)
             {
                 //鍏抽棴杩涘害鏉�
@@ -736,7 +733,7 @@
         /// <param name="listScene">閫夋嫨涓婁紶鐨勫満鏅�(涓嶈鑾峰彇瀹冮噷闈㈢殑缁戝畾鍒楄〃)</param>
         /// <param name="BarMaxValue">杩涘害鏉$殑鏈�澶у��,濡傛灉涓嶄负-1,鍒欏唴閮ㄤ笉浼氳嚜鍔ㄥ脊鍑鸿繘搴︽潯</param>
         /// <param name="listCheckFile">鏂囦欢閲嶅涓婁紶妫�娴�</param>
-        public async Task<bool> DoUploadSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
+        public bool DoUploadSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
             List<CommonDevice> listDevice, List<Common.SceneUI> listScene, int BarMaxValue = -1, HashSet<string> listCheckFile = null)
         {
             if (listDevice.Count == 0 && listScene.Count == 0)
@@ -790,11 +787,11 @@
             }
 
             //涓婁紶鍒嗕韩
-            var result = await this.DoUploadShardContent(memberShardInfo, listFile, listCheckFile);
+            var result = this.DoUploadShardContent(memberShardInfo, listFile, listCheckFile);
             if (result == true)
             {
                 //鍒犻櫎鎸囧畾鑷畾涔夊浘鐗�
-                result = await this.DoDeleteSharedContent(memberShardInfo, listDelPic);
+                result = this.DoDeleteSharedContent(memberShardInfo, listDelPic);
             }
             if (BarMaxValue == -1)
             {
@@ -1008,7 +1005,7 @@
         /// <param name="listFile">涓婁紶鐨勬枃浠跺悕</param>
         /// <param name="listCheckFile">閲嶅鏂囦欢涓婁紶妫�娴�</param>
         /// <returns></returns>
-        private async Task<bool> DoUploadShardContent(MemberShardInfoData memberShardInfo, List<string> listFile, HashSet<string> listCheckFile)
+        private bool DoUploadShardContent(MemberShardInfoData memberShardInfo, List<string> listFile, HashSet<string> listCheckFile)
         {
             var dicKeys = new Dictionary<string, string>();
             for (int i = 0; i < listFile.Count; i++)
@@ -1043,8 +1040,8 @@
                     //杩藉姞鍏变韩
                     if (memberShardInfo.dicAllShardKeys.ContainsKey(fileName) == false)
                     {
-                        var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/AddShareData", false, info);
-                        if (result == null)
+                        var result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/AddShareData", false, info, null, true);
+                        if (string.IsNullOrEmpty(result) == true)
                         {
                             return false;
                         }
@@ -1054,7 +1051,7 @@
                     else
                     {
                         info.DistributedMark = memberShardInfo.dicAllShardKeys[fileName];
-                        var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info);
+                        var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info, null, true);
                         if (result == false)
                         {
                             return false;
@@ -1275,7 +1272,7 @@
         /// <param name="listDevice">瑕佸彇娑堢殑璁惧</param>
         /// <param name="listSceneUI">瑕佸彇娑堢殑鍦烘櫙</param>
         /// <returns></returns>
-        public async Task<bool> DoDeleteSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
+        public bool DoDeleteSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
             List<CommonDevice> listDevice, List<SceneUI> listSceneUI)
         {
             var roomTemp = memberShardInfo.dicShardRoom[nowRoom.FileName];
@@ -1404,12 +1401,12 @@
             }
 
             //鎵ц绉婚櫎鍒嗕韩鏁版嵁
-            var result = await this.DoDeleteSharedContent(memberShardInfo, nowRoom, listMark, listDeleteFile);
+            var result = this.DoDeleteSharedContent(memberShardInfo, nowRoom, listMark, listDeleteFile);
             //鍚屾鎴块棿鏂囦欢
             if (result == true && listDeleteFile.Contains(roomTemp.FileName) == false)
             {
                 //鎵ц涓婁紶鎴块棿瀵硅薄
-                result = await this.DoUploadRoomObject(memberShardInfo, roomTemp);
+                result = this.DoUploadRoomObject(memberShardInfo, roomTemp);
             }
             //鍚屾妤煎眰鏁版嵁
             if (result == true && listDeleteFile.Contains(roomTemp.FileName) == true)
@@ -1428,7 +1425,7 @@
                     //濡傛灉璇ユゼ灞傚凡缁忓垹瀹屾埧闂翠簡,鍒欐洿鏂版ゼ灞�
                     memberShardInfo.dicShardFloor.Remove(roomTemp.FloorId);
                     //鎵ц涓婁紶瀵硅薄
-                    result = await this.DoUploadFloorObject(memberShardInfo);
+                    result = this.DoUploadFloorObject(memberShardInfo);
                 }
             }
 
@@ -1456,7 +1453,7 @@
         /// <param name="listMark">瑕佺Щ闄ょ殑涓婚敭</param>
         /// <param name="listDeleteFile">瑕佸垹闄ょ殑鏂囦欢(鎴块棿鏂囦欢闇�瑕佸垹闄ょ殑璇�,蹇呴』鏀惧湪鏈�鍚�)</param>
         /// <returns></returns>
-        private async Task<bool> DoDeleteSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
+        private bool DoDeleteSharedContent(MemberShardInfoData memberShardInfo, Common.Room nowRoom,
             List<string> listMark, List<string> listDeleteFile)
         {
             if (listMark.Count == 0)
@@ -1477,7 +1474,7 @@
 
                 info.DistributedMark = markKeys;
                 //鎵ц鍒犻櫎
-                var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/DeleteShareData", false, info);
+                var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/DeleteShareData", false, info, null, true);
                 if (result == false)
                 {
                     //鍏抽棴杩涘害鏉�
@@ -1508,7 +1505,7 @@
         /// <param name="memberShardInfo">鎴愬憳鐨勫垎浜唴瀹�</param>
         /// <param name="listDelFile">鍒犻櫎鐨勬枃浠�</param>
         /// <returns></returns>
-        private async Task<bool> DoDeleteSharedContent(MemberShardInfoData memberShardInfo, List<string> listDelFile)
+        private bool DoDeleteSharedContent(MemberShardInfoData memberShardInfo, List<string> listDelFile)
         {
             if (listDelFile.Count == 0)
             {
@@ -1526,7 +1523,7 @@
 
                 info.DistributedMark = memberShardInfo.dicAllShardKeys[fileName];
                 //鎵ц鍒犻櫎
-                var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/DeleteShareData", false, info);
+                var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/DeleteShareData", false, info, null, true);
                 if (result == false)
                 {
                     return false;
@@ -1552,7 +1549,7 @@
         /// <param name="memberShardInfo">鎴愬憳鐨勫叡浜唴瀹�</param>
         /// <param name="upDateRoom">闇�瑕佷笂浼犲埌浜戠鐨勬埧闂村璞�</param>
         /// <returns></returns>
-        private async Task<bool> DoUploadRoomObject(MemberShardInfoData memberShardInfo, Common.Room upDateRoom)
+        private bool DoUploadRoomObject(MemberShardInfoData memberShardInfo, Common.Room upDateRoom)
         {
             if (upDateRoom.Id == "Other")
             {
@@ -1566,7 +1563,7 @@
             var data = Newtonsoft.Json.JsonConvert.SerializeObject(upDateRoom);
             var byteData = System.Text.Encoding.UTF8.GetBytes(data);
             info.ShareDataBytes = byteData;
-            var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info);
+            var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info, null, true);
             if (result == false)
             {
                 return false;
@@ -1586,7 +1583,7 @@
         /// </summary>
         /// <param name="memberShardInfo">鎴愬憳鐨勫叡浜唴瀹�</param>
         /// <returns></returns>
-        private async Task<bool> DoUploadFloorObject(MemberShardInfoData memberShardInfo)
+        private bool DoUploadFloorObject(MemberShardInfoData memberShardInfo)
         {
             var info = new EditorShardContent();
             info.DistributedMark = memberShardInfo.dicAllShardKeys[DirNameResourse.ShardFloorFile];
@@ -1596,7 +1593,7 @@
             var data = Newtonsoft.Json.JsonConvert.SerializeObject(memberShardInfo.dicShardFloor);
             var byteData = System.Text.Encoding.UTF8.GetBytes(data);
             info.ShareDataBytes = byteData;
-            var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info);
+            var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeDataShare/EditShareData", false, info, null, true);
             if (result == false)
             {
                 return false;

--
Gitblit v1.8.0