using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter.Member
{
///
/// 添加成员成功的画面
///
public class AddMemberSuccessForm : DialogCommonForm
{
#region ■ 变量声明___________________________
///
/// 界面关闭事件
///
public Action FormCloseEvent = null;
///
/// 成员信息
///
private MemberInfoRes memberResult = null;
///
/// 清空事件
///
private bool clearEvent = true;
#endregion
#region ■ 初始化_____________________________
///
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
///
/// 成员信息
/// 头像的Mark
public void ShowForm(MemberInfoRes i_memberResult, string i_iconMark)
{
this.memberResult = i_memberResult;
//初始化中部控件
this.InitMiddleFrame(i_iconMark);
}
///
/// 初始化中部控件
///
private void InitMiddleFrame(string i_iconMark)
{
//背景框
var frame = new FrameLayout();
frame.Width = Application.GetRealWidth(838);
frame.Height = Application.GetRealHeight(1097);
frame.BackgroundColor = UserCenterColor.Current.White;
frame.Gravity = Gravity.Center;
frame.Radius = (uint)Application.GetRealHeight(17);
bodyFrameLayout.AddChidren(frame);
//用户图标
string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, i_iconMark + ".png");
var btnUserIcon = new ImageView();
btnUserIcon.Height = this.GetPictrueRealSize(207);
btnUserIcon.Width = this.GetPictrueRealSize(207);
btnUserIcon.Radius = (uint)this.GetPictrueRealSize(207) / 2;
btnUserIcon.Y = Application.GetRealHeight(104);
btnUserIcon.Gravity = Gravity.CenterHorizontal;
if (System.IO.File.Exists(iconPath) == true)
{
btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
}
else
{
btnUserIcon.ImagePath = "Center/Admin.png";
}
frame.AddChidren(btnUserIcon);
//昵称
var btnName = new NormalViewControl(frame.Width, Application.GetRealHeight(55), false);
btnName.IsBold = true;
btnName.TextAlignment = TextAlignment.Center;
btnName.Y = Application.GetRealHeight(334);
btnName.TextColor = UserCenterColor.Current.TextColor2;
btnName.TextSize = 16;
btnName.Text = memberResult.UserName;
if (string.IsNullOrEmpty(memberResult.UserName) == true)
{
btnName.Text = memberResult.Account;
}
frame.AddChidren(btnName);
//权限
var btnAuthority = new NormalViewControl(frame.Width, Application.GetRealHeight(50), false);
btnAuthority.TextAlignment = TextAlignment.Center;
btnAuthority.Y = Application.GetRealHeight(400);
btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor1;
btnAuthority.TextID = R.MyInternationalizationString.uMember;
btnAuthority.TextSize = 12;
frame.AddChidren(btnAuthority);
//家族成员添加成功
var btnSuccess = new NormalViewControl(frame.Width, Application.GetRealHeight(82), false);
btnSuccess.IsBold = true;
btnSuccess.Y = Application.GetRealHeight(547);
btnSuccess.TextAlignment = TextAlignment.Center;
btnSuccess.TextID = R.MyInternationalizationString.uAddMemberSuccess;
btnSuccess.TextSize = 20;
frame.AddChidren(btnSuccess);
//完成
var btnFinish = new BottomClickButton(688);
btnFinish.Y = Application.GetRealHeight(867);
btnFinish.TextID = R.MyInternationalizationString.uFinish;
frame.AddChidren(btnFinish);
btnFinish.ButtonClickEvent += (sender, e) =>
{
this.clearEvent = false;
this.CloseForm();
FormCloseEvent?.Invoke();
FormCloseEvent = null;
};
}
#endregion
#region ■ 界面关闭___________________________
///
/// 界面关闭
///
public override void CloseFormBefore()
{
if (clearEvent == true)
{
FormCloseEvent = null;
}
base.CloseFormBefore();
}
#endregion
}
}