using System;
|
using System.Collections.Generic;
|
|
namespace Shared.Phone.UserCenter.Member
|
{
|
/// <summary>
|
/// 需要添加成员的信息(确认)画面
|
/// </summary>
|
public class AddMemberInfoForm : EditorCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 成员信息
|
/// </summary>
|
private AccountInfoResult AccountResult = null;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
/// <param name="i_infoResult">成员信息</param>
|
public void ShowForm(AccountInfoResult i_infoResult)
|
{
|
this.AccountResult = i_infoResult;
|
|
//设置标题信息
|
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uMemberInformation));
|
|
//初始化中部控件
|
this.InitMiddleFrame();
|
}
|
|
|
/// <summary>
|
/// 初始化中部控件
|
/// </summary>
|
private void InitMiddleFrame()
|
{
|
//清空bodyFrame
|
this.ClearBodyFrame();
|
|
//头像
|
var btnUserIcon = new ImageView();
|
btnUserIcon.Height = this.GetPictrueRealSize(207);
|
btnUserIcon.Width = this.GetPictrueRealSize(207);
|
btnUserIcon.Radius = (uint)this.GetPictrueRealSize(207) / 2;
|
if (AccountResult.HeadImage != null)
|
{
|
btnUserIcon.ImageBytes = AccountResult.HeadImage;
|
}
|
else
|
{
|
btnUserIcon.ImagePath = "Center/Admin.png";
|
}
|
btnUserIcon.Y = Application.GetRealHeight(219);
|
btnUserIcon.Gravity = Gravity.CenterHorizontal;
|
bodyFrameLayout.AddChidren(btnUserIcon);
|
|
//成员ID
|
var btnUserId = new NormalViewControl(800, 50, true);
|
btnUserId.IsBold = true;
|
btnUserId.Y = Application.GetRealHeight(472);
|
btnUserId.Gravity = Gravity.CenterHorizontal;
|
btnUserId.Text = AccountResult.Account;
|
btnUserId.TextAlignment = TextAlignment.Center;
|
btnUserId.TextColor = UserCenterColor.Current.TextGrayColor1;
|
bodyFrameLayout.AddChidren(btnUserId);
|
|
//昵称
|
var btnName = new NormalViewControl(800, 55, true);
|
btnName.IsBold = true;
|
btnName.Y = Application.GetRealHeight(541);
|
btnName.Gravity = Gravity.CenterHorizontal;
|
btnName.TextAlignment = TextAlignment.Center;
|
btnName.TextSize = 16;
|
btnName.Text = AccountResult.MemberName;
|
bodyFrameLayout.AddChidren(btnName);
|
|
//请确认账号是否正确{0}如正确请点击确认
|
string strMsg = Language.StringByID(R.MyInternationalizationString.uPleaseConfirmAccoutIsRightAndClick);
|
if (strMsg.Contains("{0}") == true)
|
{
|
strMsg = string.Format(strMsg, "\r\n");
|
}
|
var btnmsg = new NormalViewControl(800, 100, true);
|
btnmsg.IsBold = true;
|
btnmsg.Y = Application.GetRealHeight(913);
|
btnmsg.TextSize = 12;
|
btnmsg.Text = strMsg;
|
btnmsg.IsMoreLines = true;
|
btnmsg.TextAlignment = TextAlignment.Center;
|
btnmsg.TextColor = UserCenterColor.Current.TextGrayColor2;
|
btnmsg.Gravity = Gravity.CenterHorizontal;
|
bodyFrameLayout.AddChidren(btnmsg);
|
|
//确认添加
|
var btnOk = new BottomClickButton(688);
|
btnOk.Y = Application.GetRealHeight(1045);
|
btnOk.TextID = R.MyInternationalizationString.uConfirmAdd;
|
bodyFrameLayout.AddChidren(btnOk);
|
btnOk.ButtonClickEvent += (sender, e) =>
|
{
|
//添加成员
|
HdlThreadLogic.Current.RunThread(() =>
|
{
|
this.DoAddMember();
|
});
|
};
|
}
|
|
#endregion
|
|
#region ■ 添加成员___________________________
|
|
/// <summary>
|
/// 添加成员
|
/// </summary>
|
private void DoAddMember()
|
{
|
//开启进度条
|
this.ShowProgressBar();
|
|
//添加成员
|
var memberInfoRes = HdlMemberLogic.Current.AddMember(AccountResult.Account, AccountResult.MemberName);
|
if (memberInfoRes == null)
|
{
|
//关闭进度条
|
this.CloseProgressBar();
|
return;
|
}
|
//添加子账号时,接口并不返回这些东西,所以需要手动赋值
|
memberInfoRes.ChildNickName = AccountResult.MemberName;
|
if (AccountResult.Account.Contains("@") == true)
|
{
|
memberInfoRes.ChildAccountEmail = AccountResult.Account;
|
}
|
else
|
{
|
memberInfoRes.ChildAccountPhone = AccountResult.Account;
|
}
|
|
string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, memberInfoRes.ChildAccountId + ".png");
|
if (AccountResult.HeadImage != null)
|
{
|
//写入头像内容
|
Shared.IO.FileUtils.WriteFileByBytes(iconPath, AccountResult.HeadImage);
|
}
|
|
//关闭进度条
|
this.CloseProgressBar();
|
|
HdlThreadLogic.Current.RunMain(() =>
|
{
|
//成员添加成功
|
var form = new AddMemberSuccessForm();
|
form.AddForm(memberInfoRes);
|
form.FormCloseEvent += (() =>
|
{
|
this.CloseForm();
|
//关闭手动输入成员ID的画面
|
HdlFormLogic.Current.CloseFormByFormName("AddMemberByIdForm");
|
//添加成员
|
this.LoadFormMethodByName("MemberListForm", "AddRowLayoutByOtherForm", memberInfoRes);
|
});
|
});
|
}
|
|
#endregion
|
}
|
}
|