From d01084d99dd3cf12e89bb32135f84f13970500f9 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 19 五月 2020 09:42:07 +0800
Subject: [PATCH] 2020-05-19-1
---
ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs | 239 ++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 186 insertions(+), 53 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
index 81b3c85..d5b2cbd 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,17 +42,27 @@
titleIcon.InitControl();
titleIcon.ButtonClickEvent += (sender, e) =>
{
- var menuContr = new TopRightMenuControl(this, 2);
+ var menuContr = new TopRightMenuControl(2, 2);
//鎵弿浜岀淮鐮�
string msg1 = Language.StringByID(R.MyInternationalizationString.uScanQRcode);
- menuContr.AddRowMenu(msg1,"","", () =>
+ 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
+ this.SearchMemberInfo(qrCode);
+ },
+ Language.StringByID(R.MyInternationalizationString.uCancel),
+ Language.StringByID(R.MyInternationalizationString.uFlashlamp),
+ msg1);
});
//杈撳叆璐﹀彿
string msg2 = Language.StringByID(R.MyInternationalizationString.uInputAccount);
- menuContr.AddRowMenu(msg2,"","", () =>
+ menuContr.AddRowMenu(msg2, "Item/InputAccountIcon.png", "Item/InputAccountIconSelected.png", () =>
{
var form = new AddMemberByIdForm();
form.AddForm();
@@ -69,9 +87,6 @@
//鍒濆鍖栧垪琛ㄦ帶浠�
this.InitMemberListControl();
-
- //鎬讳箣鍏堟竻绌哄叡浜枃浠跺す鍑嗘病閿�
- HdlShardLogic.Current.ClearShardDirectory();
}
#endregion
@@ -89,11 +104,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 = UserCenterResourse.UserInfo.UserIconFile;
btnUserIcon.Y = Application.GetRealHeight(46);
- btnUserIcon.Radius = (uint)Application.GetMinRealAverage(207) / 2;
btnUserIcon.Gravity = Gravity.CenterHorizontal;
- btnUserIcon.UnSelectedImagePath = "Center/Admin.png";
frameBack.AddChidren(btnUserIcon);
//鏄电О
@@ -109,7 +126,7 @@
btnAuthority.TextAlignment = TextAlignment.Center;
btnAuthority.Y = btnName.Bottom + Application.GetRealHeight(10);
btnAuthority.TextSize = 12;
- btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor;
+ btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor1;
btnAuthority.Text = UserCenterResourse.UserInfo.AuthorityText;
frameBack.AddChidren(btnAuthority);
}
@@ -132,15 +149,26 @@
btnMenberTile.TextSize = 15;
bodyFrameLayout.AddChidren(btnMenberTile);
+ var frameBack = new FrameLayout();
+ frameBack.Y = btnMenberTile.Bottom + Application.GetRealHeight(23);
+ frameBack.Height = Application.GetRealHeight(11);
+ frameBack.BackgroundColor = UserCenterColor.Current.White;
+ bodyFrameLayout.AddChidren(frameBack);
+
//娣诲姞鍙互鍚戜笅婊氬姩鐨勬帶浠�
listView = new VerticalListControl(12);
- listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(567);
+ listView.Height = bodyFrameLayout.Height - frameBack.Bottom;
listView.BackgroundColor = UserCenterColor.Current.White;
- listView.Y = Application.GetRealHeight(567);
+ listView.Y = frameBack.Bottom;
bodyFrameLayout.AddChidren(listView);
- //鍒濆鍖栨垚鍛樺垪琛�
- this.InitMemberList();
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ //鎬讳箣鍏堟竻绌哄叡浜枃浠跺す鍑嗘病閿�
+ HdlShardLogic.Current.ClearShardDirectory();
+ //鍒濆鍖栨垚鍛樺垪琛�
+ this.InitMemberList();
+ });
}
/// <summary>
@@ -184,12 +212,17 @@
{
if (listCheck.Contains(infoRes.DistributedMark) == true
|| infoRes.Account == UserCenterResourse.UserInfo.Phone
- || infoRes.Account == UserCenterResourse.UserInfo.Email
- || infoRes.AccountType != 0)
+ || infoRes.Account == UserCenterResourse.UserInfo.Email)
{
- //濡傛灉鏄畠鑷繁鐨勮瘽,鎴栬�呮潈闄愮瓑绾ф瘮浠栭珮鐨勶紝涓嶆樉绀�
+ //濡傛灉鏄畠鑷繁鐨勮瘽锛屼笉鏄剧ず
continue;
}
+ if (UserCenterResourse.UserInfo.AuthorityNo != 1 && infoRes.AccountType != 0)
+ {
+ //涓嶈兘澶熻幏鍙栨潈闄愮瓑绾ф瘮浠栭珮鐨�(涓讳汉鑷繁鍙互鏃犺杩欎釜鍒ゆ柇)
+ continue;
+ }
+
listCheck.Add(infoRes.DistributedMark);
//娣诲姞鎴愬憳淇℃伅鐨勭紦瀛�
UserCenterResourse.ListMemberInfo.Add(infoRes);
@@ -201,9 +234,11 @@
{
return;
}
-
- //娣诲姞鎴愬憳鍒楄〃
- this.AddMemberListRowByData();
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //娣诲姞鎴愬憳鍒楄〃
+ this.AddMemberListRowByData();
+ });
}
/// <summary>
@@ -223,18 +258,10 @@
//娣诲姞鎴愬憳琛�
this.AddRowLayout(listNewInfo[i], i != count);
}
- if (listNewInfo.Count == 0)
- {
- return;
- }
//璋冩暣鍒楄〃鎺т欢鐨勯珮搴�
- var realHeight = listNewInfo.Count * listView.GetChildren(listView.ChildrenCount - 1).Height;
- realHeight += Application.GetRealHeight(23) - listView.rowSpace + Application.GetRealHeight(23);
- if (realHeight < listView.Height)
- {
- //缂╁皬鎺т欢楂樺害
- listView.Height = realHeight;
- }
+ listView.AdjustRealHeight(Application.GetRealHeight(23));
+ //鑾峰彇鎴愬憳澶村儚
+ this.GetMemberIcon();
}
#endregion
@@ -248,30 +275,35 @@
/// <param name="addLine">addLine</param>
private void AddRowLayout(MemberInfoRes info, bool addLine)
{
- if (listView.ChildrenCount == 0)
- {
- //濉炰竴涓┖鐧界殑杩涘幓鍗犵┖闂�
- var rowTemp = new FrameRowControl();
- rowTemp.UseClickStatu = false;
- rowTemp.Height = Application.GetRealHeight(23) - listView.rowSpace;
- rowTemp.MainKeys = string.Empty;
- listView.AddChidren(rowTemp);
- }
-
var rowlayout = new FrameRowControl(listView.rowSpace / 2);
rowlayout.Height = Application.GetRealHeight(138);
rowlayout.MainKeys = info.Account;
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(UserCenterResourse.AccountOption.UserPictruePath, info.DistributedMark + ".png");
+ var btnIcon = new ImageView();
+ btnIcon.X = ControlCommonResourse.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.DistributedMark] = btnIcon;
+ this.dicMemberAccount[info.DistributedMark] = info.Account;
+ }
rowlayout.AddChidren(btnIcon);
//鎴愬憳鏄电О
string memberName = string.IsNullOrEmpty(info.UserName) == true ? info.Account : info.UserName;
var btnName = rowlayout.AddLeftCaption(memberName, 600, true);
+ btnName.X = ControlCommonResourse.XXLeft + btnIcon.Height + Application.GetRealWidth(35);
btnName.TextSize = 15;
rowlayout.AddChidren(btnName);
@@ -289,12 +321,77 @@
};
}
+ /// <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(async () =>
+ {
+ var pra = new AccountInfoPra();
+ foreach (var keys in dicMemberAccount.Keys)
+ {
+ if (this.Parent == null)
+ {
+ return;
+ }
+ pra.Account = dicMemberAccount[keys];
+ var result = await UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "NotSetAgain" });
+ if (result == null)
+ {
+ continue;
+ }
+ var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(System.Text.Encoding.UTF8.GetString(result));
+ if (revertObj == null || revertObj.ResponseData == null)
+ {
+ continue;
+ }
+ var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(revertObj.ResponseData.ToString());
+ if (infoResult.HeadImage != null)
+ {
+ //鍐欏叆澶村儚鍐呭
+ string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, keys + ".png");
+ Shared.IO.FileUtils.WriteFileByBytes(iconPath, infoResult.HeadImage);
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ dicIconControl[keys].ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
+ });
+ }
+ }
+ });
+ }
+
#endregion
#region 鈻� 鍒犻櫎鎸囧畾琛宊________________________
/// <summary>
- /// 鍒犻櫎鎸囧畾琛�
+ /// 鍒犻櫎鎸囧畾琛�(澶栭儴璋冪敤)
/// </summary>
/// <param name="accountId"></param>
public void DeleteRowByAccount(string accountId)
@@ -309,9 +406,49 @@
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 async 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)
+ {
+ //寮傚父
+ return;
+ }
+ if (result == string.Empty)
+ {
+ //鎴愬憳涓嶅瓨鍦�
+ var form = new MemberNotEsixtForm();
+ form.AddForm();
+ return;
+ }
+
+ var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(result);
+ infoResult.Account = accountId;
+
+ Application.RunOnMainThread(() =>
+ {
+ var form = new AddMemberInfoForm();
+ form.AddForm(infoResult);
+ });
}
#endregion
@@ -321,16 +458,12 @@
/// <summary>
/// 鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠�
/// </summary>
- public override void FormActionAgainEvent()
+ public override int FormActionAgainEvent()
{
//娓呯┖鍏变韩鏂囦欢澶�
HdlShardLogic.Current.ClearShardDirectory();
- this.listView.RemoveAll();
- listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(567);
-
- //娣诲姞鎴愬憳鍒楄〃
- this.AddMemberListRowByData();
+ return 1;
}
#endregion
--
Gitblit v1.8.0