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/Member/MemberListForm.cs | 44 +++++++++++++++++++++-----------------------
1 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
index d5b2cbd..36ed38d 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
@@ -54,7 +54,10 @@
return;
}
//鎼滅储ID
- this.SearchMemberInfo(qrCode);
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ this.SearchMemberInfo(qrCode);
+ });
},
Language.StringByID(R.MyInternationalizationString.uCancel),
Language.StringByID(R.MyInternationalizationString.uFlashlamp),
@@ -174,14 +177,14 @@
/// <summary>
/// 鍒濆鍖栨垚鍛樺垪琛�
/// </summary>
- private async void InitMemberList()
+ private void InitMemberList()
{
//寮�鍚繘搴︽潯
this.ShowProgressBar();
var pra = new MemberListInfoPra();
- string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
- if (result == null)
+ string result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
+ if (string.IsNullOrEmpty(result) == true)
{
//鍏抽棴杩涘害鏉�
this.CloseProgressBar(ShowReLoadMode.YES);
@@ -204,10 +207,8 @@
//鍏抽棴杩涘害鏉�
this.CloseProgressBar();
- //鍏堟竻绌烘垚鍛樺垪琛ㄤ俊鎭�
- UserCenterResourse.ListMemberInfo.Clear();
-
List<string> listCheck = new List<string>();
+ List<MemberInfoRes> listShowInfo = new List<MemberInfoRes>();
foreach (MemberInfoRes infoRes in listInfo)
{
if (listCheck.Contains(infoRes.DistributedMark) == true
@@ -225,32 +226,28 @@
listCheck.Add(infoRes.DistributedMark);
//娣诲姞鎴愬憳淇℃伅鐨勭紦瀛�
- UserCenterResourse.ListMemberInfo.Add(infoRes);
+ listShowInfo.Add(infoRes);
}
- listInfo.Clear();
- //淇濆瓨鎴愬憳淇℃伅鐨勭紦瀛樺埌鏈湴鏂囦欢
- UserCenterLogic.SaveLocalMemberListInfo();
- if (UserCenterResourse.ListMemberInfo.Count == 0)
+ if (listShowInfo.Count == 0)
{
return;
}
HdlThreadLogic.Current.RunMain(() =>
{
//娣诲姞鎴愬憳鍒楄〃
- this.AddMemberListRowByData();
+ this.AddMemberListRowByData(listShowInfo);
});
}
/// <summary>
/// 娣诲姞鎴愬憳鍒楄〃
/// </summary>
- private void AddMemberListRowByData()
+ private void AddMemberListRowByData(List<MemberInfoRes> listNewInfo)
{
if (this.Parent == null)
{
return;
}
- var listNewInfo = UserCenterResourse.ListMemberInfo;
int count = listNewInfo.Count - 1;
for (int i = 0; i < listNewInfo.Count; i++)
@@ -351,7 +348,7 @@
{
return;
}
- HdlThreadLogic.Current.RunThread(async () =>
+ HdlThreadLogic.Current.RunThread(() =>
{
var pra = new AccountInfoPra();
foreach (var keys in dicMemberAccount.Keys)
@@ -361,7 +358,7 @@
return;
}
pra.Account = dicMemberAccount[keys];
- var result = await UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "NotSetAgain" });
+ var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra);
if (result == null)
{
continue;
@@ -423,17 +420,18 @@
/// </summary>
/// <param name="accountId">鎴愬憳ID</param>
/// <param name="txtMsg">淇℃伅鎺т欢</param>
- private async void SearchMemberInfo(string accountId)
+ private void SearchMemberInfo(string accountId)
{
var pra = new AccountInfoPra();
pra.Account = accountId;
- string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "AccountNoExists" });
- if (result == null)
+ var byteData = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "AccountNoExists" });
+ if (byteData == null)
{
//寮傚父
return;
}
- if (result == string.Empty)
+ var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(System.Text.Encoding.UTF8.GetString(byteData));
+ if (revertObj.StateCode == "AccountNoExists")
{
//鎴愬憳涓嶅瓨鍦�
var form = new MemberNotEsixtForm();
@@ -441,10 +439,10 @@
return;
}
- var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(result);
+ var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(revertObj.ResponseData.ToString());
infoResult.Account = accountId;
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
var form = new AddMemberInfoForm();
form.AddForm(infoResult);
--
Gitblit v1.8.0