From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3
---
ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs | 233 +++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 164 insertions(+), 69 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
index c013c61..eb9aa90 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
@@ -15,6 +15,14 @@
/// 鍒楄〃鎺т欢
/// </summary>
private VerticalListControl listView = null;
+ /// <summary>
+ /// 鎴愬憳澶村儚鎺т欢
+ /// </summary>
+ private Dictionary<string, ImageView> dicIconControl = new Dictionary<string, ImageView>();
+ /// <summary>
+ /// 鎴愬憳鐨勮处鍙�(鑾峰彇澶村儚鐢�)
+ /// </summary>
+ private Dictionary<string, string> dicMemberAccount = new Dictionary<string, string>();
#endregion
@@ -34,13 +42,26 @@
titleIcon.InitControl();
titleIcon.ButtonClickEvent += (sender, e) =>
{
- var menuContr = new TopRightMenuControl(this, 2, 449);
+ var menuContr = new TopRightMenuControl(2, 2);
//鎵弿浜岀淮鐮�
string msg1 = Language.StringByID(R.MyInternationalizationString.uScanQRcode);
menuContr.AddRowMenu(msg1, "Item/ScanQRcodeIcon.png", "Item/ScanQRcodeIconSelected.png", () =>
{
- var form = new AddMemberByIdForm();
- form.AddForm();
+ QRCode.ScanQRcode((qrCode) =>
+ {
+ if (string.IsNullOrEmpty(qrCode) == true)
+ {
+ return;
+ }
+ //鎼滅储ID
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ this.SearchMemberInfo(qrCode);
+ });
+ },
+ Language.StringByID(R.MyInternationalizationString.uCancel),
+ Language.StringByID(R.MyInternationalizationString.uFlashlamp),
+ msg1);
});
//杈撳叆璐﹀彿
string msg2 = Language.StringByID(R.MyInternationalizationString.uInputAccount);
@@ -86,11 +107,13 @@
bodyFrameLayout.AddChidren(frameBack);
//鐢ㄦ埛鍥炬爣
- var btnUserIcon = new PicViewControl(207, 207);
+ var btnUserIcon = new ImageView();
+ btnUserIcon.Height = this.GetPictrueRealSize(207);
+ btnUserIcon.Width = this.GetPictrueRealSize(207);
+ btnUserIcon.Radius = (uint)this.GetPictrueRealSize(207) / 2;
+ btnUserIcon.ImagePath = HdlFileNameResourse.UserHeadIconFile;
btnUserIcon.Y = Application.GetRealHeight(46);
- btnUserIcon.Radius = (uint)Application.GetMinRealAverage(207) / 2;
btnUserIcon.Gravity = Gravity.CenterHorizontal;
- btnUserIcon.UnSelectedImagePath = "Center/Admin.png";
frameBack.AddChidren(btnUserIcon);
//鏄电О
@@ -98,7 +121,7 @@
btnName.TextAlignment = TextAlignment.Center;
btnName.Y = btnUserIcon.Bottom + Application.GetRealHeight(20);
btnName.TextSize = 16;
- btnName.Text = UserCenterResourse.UserInfo.UserName; ;
+ btnName.Text = HdlUserCenterResourse.UserInfo.NickName; ;
frameBack.AddChidren(btnName);
//韬唤
@@ -106,8 +129,8 @@
btnAuthority.TextAlignment = TextAlignment.Center;
btnAuthority.Y = btnName.Bottom + Application.GetRealHeight(10);
btnAuthority.TextSize = 12;
- btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor;
- btnAuthority.Text = UserCenterResourse.UserInfo.AuthorityText;
+ btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor1;
+ btnAuthority.Text = HdlUserCenterResourse.ResidenceOption.AuthorityText;
frameBack.AddChidren(btnAuthority);
}
@@ -122,7 +145,7 @@
{
//鏍囬:鎴愬憳鍒楄〃
var btnMenberTile = new NormalViewControl(800, 60, true);
- btnMenberTile.X = ControlCommonResourse.XXLeft;
+ btnMenberTile.X = HdlControlResourse.XXLeft;
btnMenberTile.Y = Application.GetRealHeight(480);
btnMenberTile.TextColor = UserCenterColor.Current.TextColor1;
btnMenberTile.TextID = R.MyInternationalizationString.MenberList;
@@ -142,10 +165,10 @@
listView.Y = frameBack.Bottom;
bodyFrameLayout.AddChidren(listView);
- HdlThreadLogic.Current.RunMainInThread(() =>
+ HdlThreadLogic.Current.RunThread(() =>
{
//鎬讳箣鍏堟竻绌哄叡浜枃浠跺す鍑嗘病閿�
- HdlShardLogic.Current.ClearShardDirectory();
+ HdlShardLogic.Current.Dispone();
//鍒濆鍖栨垚鍛樺垪琛�
this.InitMemberList();
});
@@ -154,28 +177,13 @@
/// <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)
- {
- //鍏抽棴杩涘害鏉�
- this.CloseProgressBar(ShowReLoadMode.YES);
- return;
- }
- if (this.Parent == null)
- {
- //鍏抽棴杩涘害鏉�
- this.CloseProgressBar();
- return;
- }
-
- List<MemberInfoRes> listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MemberInfoRes>>(result);
- if (listInfo == null)
+ var listShowInfo = HdlMemberLogic.Current.GetMemberListInfo();
+ if (listShowInfo == null)
{
//鍏抽棴杩涘害鏉�
this.CloseProgressBar(ShowReLoadMode.YES);
@@ -184,46 +192,26 @@
//鍏抽棴杩涘害鏉�
this.CloseProgressBar();
- //鍏堟竻绌烘垚鍛樺垪琛ㄤ俊鎭�
- UserCenterResourse.ListMemberInfo.Clear();
-
- List<string> listCheck = new List<string>();
- foreach (MemberInfoRes infoRes in listInfo)
- {
- if (listCheck.Contains(infoRes.DistributedMark) == true
- || infoRes.Account == UserCenterResourse.UserInfo.Phone
- || infoRes.Account == UserCenterResourse.UserInfo.Email
- || infoRes.AccountType != 0)
- {
- //濡傛灉鏄畠鑷繁鐨勮瘽,鎴栬�呮潈闄愮瓑绾ф瘮浠栭珮鐨勶紝涓嶆樉绀�
- continue;
- }
- listCheck.Add(infoRes.DistributedMark);
- //娣诲姞鎴愬憳淇℃伅鐨勭紦瀛�
- UserCenterResourse.ListMemberInfo.Add(infoRes);
- }
- listInfo.Clear();
- //淇濆瓨鎴愬憳淇℃伅鐨勭紦瀛樺埌鏈湴鏂囦欢
- UserCenterLogic.SaveLocalMemberListInfo();
- if (UserCenterResourse.ListMemberInfo.Count == 0)
+ if (listShowInfo.Count == 0)
{
return;
}
-
- //娣诲姞鎴愬憳鍒楄〃
- this.AddMemberListRowByData();
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //娣诲姞鎴愬憳鍒楄〃
+ 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++)
@@ -233,6 +221,8 @@
}
//璋冩暣鍒楄〃鎺т欢鐨勯珮搴�
listView.AdjustRealHeight(Application.GetRealHeight(23));
+ //鑾峰彇鎴愬憳澶村儚
+ this.GetMemberIcon();
}
#endregion
@@ -252,14 +242,29 @@
listView.AddChidren(rowlayout);
//鎴愬憳澶村儚鍥炬爣
- var btnIcon = rowlayout.AddLeftIcon(115);
- btnIcon.Radius = (uint)btnIcon.IconSize / 2;
- btnIcon.UnSelectedImagePath = "Center/Admin.png";
+ string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, info.ChildAccountId + ".png");
+ var btnIcon = new ImageView();
+ btnIcon.X = HdlControlResourse.XXLeft;
+ btnIcon.Gravity = Gravity.CenterVertical;
+ btnIcon.Height = this.GetPictrueRealSize(115);
+ btnIcon.Width = this.GetPictrueRealSize(115);
+ btnIcon.Radius = (uint)this.GetPictrueRealSize(115) / 2;
+ if (System.IO.File.Exists(iconPath) == true)
+ {
+ btnIcon.ImagePath = iconPath;
+ }
+ else
+ {
+ btnIcon.ImagePath = "Center/Admin.png";
+ this.dicIconControl[info.ChildAccountId] = btnIcon;
+ this.dicMemberAccount[info.ChildAccountId] = info.Account;
+ }
rowlayout.AddChidren(btnIcon);
//鎴愬憳鏄电О
- string memberName = string.IsNullOrEmpty(info.UserName) == true ? info.Account : info.UserName;
+ string memberName = info.ShowName;
var btnName = rowlayout.AddLeftCaption(memberName, 600, true);
+ btnName.X = HdlControlResourse.XXLeft + btnIcon.Height + Application.GetRealWidth(35);
btnName.TextSize = 15;
rowlayout.AddChidren(btnName);
@@ -277,12 +282,65 @@
};
}
+ /// <summary>
+ /// 娣诲姞鎴愬憳琛�(澶栭儴璋冪敤)
+ /// </summary>
+ /// <param name="info"></param>
+ public void AddRowLayoutByOtherForm(MemberInfoRes info)
+ {
+ var myRow = listView.GetChildren(listView.ChildrenCount - 1);
+ if (myRow != null)
+ {
+ //鏈�鍚庝竴琛屽姞搴曠嚎
+ ((FrameRowControl)myRow).AddBottomLine();
+ }
+ this.AddRowLayout(info, false);
+ //璋冩暣鍒楄〃鎺т欢鐨勯珮搴�
+ listView.AdjustRealHeight(Application.GetRealHeight(23));
+ }
+
+ #endregion
+
+ #region 鈻� 鑾峰彇鎴愬憳澶村儚_______________________
+
+ /// <summary>
+ /// 鑾峰彇鎴愬憳澶村儚
+ /// </summary>
+ private void GetMemberIcon()
+ {
+ if (dicIconControl.Count == 0)
+ {
+ return;
+ }
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ foreach (var keys in dicMemberAccount.Keys)
+ {
+ if (this.Parent == null)
+ {
+ return;
+ }
+ var imageData = HdlAccountLogic.Current.DownLoadAccountPictrue(dicMemberAccount[keys]);
+ if (imageData != null && imageData.Length > 0)
+ {
+ //鍐欏叆澶村儚鍐呭
+ string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, keys + ".png");
+ Shared.IO.FileUtils.WriteFileByBytes(iconPath, imageData);
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ dicIconControl[keys].ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
+ });
+ }
+ }
+ });
+ }
+
#endregion
#region 鈻� 鍒犻櫎鎸囧畾琛宊________________________
/// <summary>
- /// 鍒犻櫎鎸囧畾琛�
+ /// 鍒犻櫎鎸囧畾琛�(澶栭儴璋冪敤)
/// </summary>
/// <param name="accountId"></param>
public void DeleteRowByAccount(string accountId)
@@ -297,9 +355,52 @@
if (row.MainKeys == accountId)
{
row.RemoveFromParent();
+ //璋冩暣鍒楄〃鎺т欢鐨勯珮搴�
+ listView.AdjustRealHeight(Application.GetRealHeight(23));
+
break;
}
}
+ }
+
+ #endregion
+
+ #region 鈻� 鎼滅储ID_____________________________
+
+ /// <summary>
+ /// 鎼滅储鎸囧畾ID鐨勪俊鎭�
+ /// </summary>
+ /// <param name="accountId">鎴愬憳ID</param>
+ /// <param name="txtMsg">淇℃伅鎺т欢</param>
+ private void SearchMemberInfo(string accountId)
+ {
+ //寮�鍚繘搴︽潯
+ this.ShowProgressBar();
+
+ var result = HdlMemberLogic.Current.SearchNormalInfoByAccount(accountId);
+ //鍏抽棴杩涘害鏉�
+ this.CloseProgressBar();
+
+ if (result == null)
+ {
+ return;
+ }
+ if (result.Account == string.Empty)
+ {
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //鎴愬憳涓嶅瓨鍦�
+ var form = new MemberNotEsixtForm();
+ form.AddForm(Language.StringByID(R.MyInternationalizationString.uMemberInformation));
+ });
+ return;
+ }
+
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ var form = new AddMemberInfoForm();
+ form.AddForm(result);
+ });
}
#endregion
@@ -312,13 +413,7 @@
public override int FormActionAgainEvent()
{
//娓呯┖鍏变韩鏂囦欢澶�
- HdlShardLogic.Current.ClearShardDirectory();
-
- this.listView.RemoveAll();
- listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(567);
-
- //娣诲姞鎴愬憳鍒楄〃
- this.AddMemberListRowByData();
+ HdlShardLogic.Current.Dispone();
return 1;
}
--
Gitblit v1.8.0