From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 21 七月 2020 09:46:53 +0800
Subject: [PATCH] 请合并最新多功能面板代码
---
ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs | 210 ++++++++++++++++++++++++++++++++++++----------------
1 files changed, 146 insertions(+), 64 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs
index deaf1b7..27ccb52 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs
@@ -1,4 +1,6 @@
锘縰sing System;
+using System.Collections.Generic;
+
namespace Shared.Phone.UserCenter.Member
{
/// <summary>
@@ -57,24 +59,31 @@
btnTopIcon = new MostRightIconControl(69, 69);
if (memberInfo.AccountType == 1)
{
- btnTopIcon.UnSelectedImagePath = "Account/HadAuthority.png";
+ btnTopIcon.UnSelectedImagePath = "Item/HadAuthority.png";
}
else
{
- btnTopIcon.UnSelectedImagePath = "Account/NotAuthority.png";
+ btnTopIcon.UnSelectedImagePath = "Item/NotAuthority.png";
}
topFrameLayout.AddChidren(btnTopIcon);
btnTopIcon.InitControl();
btnTopIcon.ButtonClickEvent += (sender, e) =>
{
+ //纭畾鍙栨秷銆寋0}銆嶇鐞嗗憳鏉冮檺锛�
string msg = Language.StringByID(R.MyInternationalizationString.uDownSubAccountLevel);
if (memberInfo.AccountType != 1)
{
+ //纭畾鎺堟潈銆寋0}銆嶆垚涓虹鐞嗗憳?
msg = Language.StringByID(R.MyInternationalizationString.uUpSubAccountLevel);
}
+ msg = msg.Replace("{0}", string.IsNullOrEmpty(memberInfo.UserName) == true ? memberInfo.Account : memberInfo.UserName);
+
this.ShowMassage(ShowMsgType.Confirm, msg, () =>
{
- this.UpOrDownSubAccountLevel();
+ //浜屾瀹夊叏楠岃瘉,濡傛灉娌℃湁璁剧疆鏈�,鐩存帴璺宠繃楠岃瘉
+ HdlCheckLogic.Current.CheckSecondarySecurity(
+ () => { this.UpOrDownSubAccountLevel(); },
+ () => { this.UpOrDownSubAccountLevel(); });
});
};
}
@@ -105,11 +114,24 @@
bodyFrameLayout.AddChidren(frame);
//鐢ㄦ埛鍥炬爣
- var btnUserIcon = new PicViewControl(207, 207);
+ string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfo.DistributedMark + ".png");
+ var btnUserIcon = new ImageView();
+ btnUserIcon.Height = this.GetPictrueRealSize(207);
+ btnUserIcon.Width = this.GetPictrueRealSize(207);
+ btnUserIcon.Radius = (uint)this.GetPictrueRealSize(207) / 2;
+ if (System.IO.File.Exists(iconPath) == true)
+ {
+ btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
+ }
+ else
+ {
+ btnUserIcon.ImagePath = "Center/Admin.png";
+ }
btnUserIcon.Y = Application.GetRealHeight(45);
btnUserIcon.Gravity = Gravity.CenterHorizontal;
- btnUserIcon.UnSelectedImagePath = "Center/Admin.png";
frame.AddChidren(btnUserIcon);
+ //鑾峰彇鎴愬憳澶村儚
+ this.GetMemberIcon(btnUserIcon);
//鏉冮檺
btnAuthority = new NormalViewControl(800, 50, true);
@@ -117,7 +139,7 @@
btnAuthority.TextSize = 12;
btnAuthority.Y = btnUserIcon.Bottom + Application.GetRealHeight(23);
btnAuthority.Gravity = Gravity.CenterHorizontal;
- btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor;
+ btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor1;
btnAuthority.TextID = R.MyInternationalizationString.uMember;
if (memberInfo.AccountType == 1)
{
@@ -137,7 +159,7 @@
private void InitInfoList()
{
//鏍囬:鎴愬憳鏉冮檺
- var btnMenberTile = new DetailTitleControl(800, 60, true);
+ var btnMenberTile = new NormalViewControl(800, 60, true);
btnMenberTile.X = ControlCommonResourse.XXLeft;
btnMenberTile.Y = Application.GetRealHeight(418);
btnMenberTile.TextColor = UserCenterColor.Current.TextColor2;
@@ -169,9 +191,9 @@
this.AddShardContentRow(rowShard);
//涓�鏃︾Щ闄よ瀹跺涵鎴愬憳锛屼粬/濂瑰皢鏃犳硶浣跨敤璇ョ綉鍏充笅鎵�缁戝畾鐨勮澶�
- var btnNote1 = new NormalViewControl(613, 98, true);
- btnNote1.X = Application.GetRealWidth(246);
- btnNote1.Y = Application.GetRealHeight(1328);
+ var btnNote1 = new NormalViewControl(613, 100, true);
+ btnNote1.X = Application.GetRealWidth(248);
+ btnNote1.Y = Application.GetRealHeight(1327);
btnNote1.TextSize = 12;
btnNote1.TextID = R.MyInternationalizationString.RemoveMenberAndDonotUserBindGatewayDevice;
btnNote1.IsMoreLines = true;
@@ -181,7 +203,7 @@
var btnIcon = new IconViewControl(58);
btnIcon.X = Application.GetRealWidth(167);
- btnIcon.Y = Application.GetRealHeight(1328);
+ btnIcon.Y = btnNote1.Y;
btnIcon.UnSelectedImagePath = "Item/Tips.png";
bodyFrameLayout.AddChidren(btnIcon);
@@ -197,7 +219,10 @@
this.ShowMassage(ShowMsgType.Confirm, msg, () =>
{
//鍒犻櫎瀛愯处鍙�
- this.DeleteSubAccount();
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ this.DeleteSubAccount();
+ });
});
};
}
@@ -222,13 +247,41 @@
btnName.TextSize = 15;
//寮�鍏�
- var btnSwitch = row.AddMostRightEmptyIcon(104, 63);
- row.ChangedChidrenBindMode(btnSwitch, ChidrenBindMode.NotBind);
- btnSwitch.UnSelectedImagePath = "Item/Switch.png";
- btnSwitch.SelectedImagePath = "Item/SwitchSelected.png";
+ var btnSwitch = row.AddMostRightSwitchIcon();
+ if (this.memberInfo.IsAllowRemoteCtrl == true)
+ {
+ btnSwitch.IsSelected = true;
+ }
btnSwitch.ButtonClickEvent += (sender, e) =>
{
- btnSwitch.IsSelected = !btnSwitch.IsSelected;
+ btnSwitch.CanClick = false;
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ var pra = new
+ {
+ HouseDistributedMark = Common.Config.Instance.Home.Id,
+ DistributedMark = this.memberInfo.DistributedMark,
+ IsAllowRemoteCtrl = !btnSwitch.IsSelected
+ };
+ //鎵撳紑杩涘害鏉�
+ this.ShowProgressBar();
+ var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ChangeSubAccountIsAllowRemoteCtrl", false, pra);
+ //鍏抽棴杩涘害鏉�
+ this.CloseProgressBar();
+
+ if (result == false)
+ {
+ return;
+ }
+ this.memberInfo.IsAllowRemoteCtrl = !btnSwitch.IsSelected;
+
+ Application.RunOnMainThread(() =>
+ {
+ btnSwitch.CanClick = true;
+ btnSwitch.IsSelected = !btnSwitch.IsSelected;
+ });
+ });
+
};
//搴曠嚎
row.AddBottomLine();
@@ -259,7 +312,7 @@
var memberShardInfo = new MemberShardInfoData();
row.ButtonClickEvent += (sender, e) =>
{
- var form = new SharedContent.SearchConfigureSharedListRoomForm();
+ var form = new SharedContent.LookSharedListRoomForm();
form.AddForm(memberInfo, memberShardInfo);
};
}
@@ -271,49 +324,49 @@
/// <summary>
/// 鍗囩骇鎴栬�呴檷绾у瓙璐﹀彿
/// </summary>
- public async void UpOrDownSubAccountLevel()
+ public void UpOrDownSubAccountLevel()
{
- //寮�鍚繘搴︽潯
- this.ShowProgressBar();
-
- var pra = new UpOrDownLevelPra();
- pra.DistributedMark = memberInfo.DistributedMark;
-
- bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpSubAccount", false, pra);
- if (result == false)
+ HdlThreadLogic.Current.RunThread(() =>
{
- this.CloseProgressBar();
- return;
- }
- this.CloseProgressBar();
+ //寮�鍚繘搴︽潯
+ this.ShowProgressBar();
- //鍙樻洿鏉冮檺
- memberInfo.AccountType = memberInfo.AccountType == 1 ? 0 : 1;
+ var pra = new UpOrDownLevelPra();
+ pra.DistributedMark = memberInfo.DistributedMark;
- Application.RunOnMainThread(() =>
- {
- if (this.Parent == null)
+ bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpSubAccount", false, pra);
+ if (result == false)
{
+ this.CloseProgressBar();
return;
}
- //鍙樻洿鏉冮檺鍥炬爣
- if (memberInfo.AccountType == 1)
- {
- btnTopIcon.UnSelectedImagePath = "Account/HadAuthority.png";
- }
- else
- {
- btnTopIcon.UnSelectedImagePath = "Account/NotAuthority.png";
- }
- //鍙樻洿鏉冮檺鏂囧瓧
- btnAuthority.TextID = memberInfo.AccountType == 1 ? R.MyInternationalizationString.uMemberHadActionAuthority : R.MyInternationalizationString.uMember;
+ this.CloseProgressBar();
- //鎵撳紑鏄剧ず鎴愬姛鐨勭敾闈�
- if (memberInfo.AccountType == 1)
+ //鍙樻洿鏉冮檺
+ memberInfo.AccountType = memberInfo.AccountType == 1 ? 0 : 1;
+
+ HdlThreadLogic.Current.RunMain(() =>
{
+ if (this.Parent == null)
+ {
+ return;
+ }
+ //鍙樻洿鏉冮檺鍥炬爣
+ if (memberInfo.AccountType == 1)
+ {
+ btnTopIcon.UnSelectedImagePath = "Item/HadAuthority.png";
+ }
+ else
+ {
+ btnTopIcon.UnSelectedImagePath = "Item/NotAuthority.png";
+ }
+ //鍙樻洿鏉冮檺鏂囧瓧
+ btnAuthority.TextID = memberInfo.AccountType == 1 ? R.MyInternationalizationString.uMemberHadActionAuthority : R.MyInternationalizationString.uMember;
+
+ //鎵撳紑鏄剧ず鎴愬姛鐨勭敾闈�
var form = new SubAccountLevelUpSuccessForm();
form.AddForm(memberInfo);
- }
+ });
});
}
@@ -324,7 +377,7 @@
/// <summary>
/// 鍒犻櫎瀛愯处鍙�
/// </summary>
- private async void DeleteSubAccount()
+ private void DeleteSubAccount()
{
//寮�鍚繘搴︽潯
this.ShowProgressBar();
@@ -332,7 +385,7 @@
var pra = new DeleteSubAccountPra();
pra.SubAccount = memberInfo.SubAccountDistributedMark;
- bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/DeletedSubAccount", false, pra);
+ bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/DeletedSubAccount", false, pra);
//鍏抽棴杩涘害鏉�
this.CloseProgressBar();
@@ -341,21 +394,50 @@
return;
}
- //绉婚櫎缂撳瓨
- UserCenterResourse.ListMemberInfo.RemoveAll((obj) =>
+ HdlThreadLogic.Current.RunMain(() =>
{
- if (obj.SubAccountDistributedMark == memberInfo.SubAccountDistributedMark)
- {
- return true;
- }
- return false;
+ //浠庢垚鍛樹竴瑙堢敾闈㈢Щ闄�
+ this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account);
+ //鑷韩鍏抽棴
+ this.CloseForm();
});
- UserCenterLogic.SaveLocalMemberListInfo();
+ }
- //浠庢垚鍛樹竴瑙堢敾闈㈢Щ闄�
- this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account);
- //鑷韩鍏抽棴
- this.CloseForm();
+ #endregion
+
+ #region 鈻� 鑾峰彇鎴愬憳澶村儚_______________________
+
+ /// <summary>
+ /// 鑾峰彇鎴愬憳澶村儚
+ /// </summary>
+ private void GetMemberIcon(ImageView btnUserIcon)
+ {
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ var pra = new AccountInfoPra();
+ pra.Account = memberInfo.Account;
+ var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" });
+ if (result == null)
+ {
+ return;
+ }
+ var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(System.Text.Encoding.UTF8.GetString(result));
+ if (revertObj == null || revertObj.ResponseData == null)
+ {
+ return;
+ }
+ var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(revertObj.ResponseData.ToString());
+ if (infoResult.HeadImage != null)
+ {
+ //鍐欏叆澶村儚鍐呭
+ string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfo.DistributedMark + ".png");
+ Shared.IO.FileUtils.WriteFileByBytes(iconPath, infoResult.HeadImage);
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
+ });
+ }
+ });
}
#endregion
--
Gitblit v1.8.0