| | |
| | | /// 列表控件
|
| | | /// </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
|
| | |
|
| | |
| | | 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
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | 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();
|
| | |
| | |
|
| | | //初始化列表控件
|
| | | this.InitMemberListControl();
|
| | |
|
| | | //总之先清空共享文件夹准没错
|
| | | HdlShardLogic.Current.ClearShardDirectory();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | 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);
|
| | |
|
| | | //昵称
|
| | |
| | | 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);
|
| | | }
|
| | |
| | | listView.Y = frameBack.Bottom;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | //初始化成员列表
|
| | | this.InitMemberList();
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //总之先清空共享文件夹准没错
|
| | | HdlShardLogic.Current.ClearShardDirectory();
|
| | | //初始化成员列表
|
| | | this.InitMemberList();
|
| | | });
|
| | | }
|
| | |
|
| | | /// <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);
|
| | |
| | | //关闭进度条
|
| | | 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
|
| | | || 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);
|
| | | listShowInfo.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++)
|
| | |
| | | }
|
| | | //调整列表控件的高度
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | //获取成员头像
|
| | | this.GetMemberIcon();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | 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);
|
| | |
|
| | |
| | | };
|
| | | }
|
| | |
|
| | | /// <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(() =>
|
| | | {
|
| | | var pra = new AccountInfoPra();
|
| | | foreach (var keys in dicMemberAccount.Keys)
|
| | | {
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | pra.Account = dicMemberAccount[keys];
|
| | | var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" }, false);
|
| | | 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)
|
| | |
| | | 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)
|
| | | {
|
| | | var pra = new AccountInfoPra();
|
| | | pra.Account = accountId;
|
| | | var byteData = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "AccountNoExists" });
|
| | | if (byteData == null)
|
| | | {
|
| | | //异常
|
| | | return;
|
| | | }
|
| | | var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(System.Text.Encoding.UTF8.GetString(byteData));
|
| | | if (revertObj.StateCode == "AccountNoExists")
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //成员不存在
|
| | | var form = new MemberNotEsixtForm();
|
| | | form.AddForm(Language.StringByID(R.MyInternationalizationString.uMemberInformation));
|
| | | });
|
| | | return;
|
| | | }
|
| | |
|
| | | var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(revertObj.ResponseData.ToString());
|
| | | infoResult.Account = accountId;
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | var form = new AddMemberInfoForm();
|
| | | form.AddForm(infoResult);
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | {
|
| | | //清空共享文件夹
|
| | | HdlShardLogic.Current.ClearShardDirectory();
|
| | |
|
| | | this.listView.RemoveAll();
|
| | | listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(567);
|
| | |
|
| | | //添加成员列表
|
| | | this.AddMemberListRowByData();
|
| | |
|
| | | return 1;
|
| | | }
|