using System;
|
using Shared;
|
using HDL_ON.UI.CSS;
|
using HDL_ON.Stan;
|
using System.Collections.Generic;
|
|
namespace HDL_ON.UI
|
{
|
/// <summary>
|
/// 执行过户操作的界面
|
/// </summary>
|
public class TransferingResidenceForm : EditorCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 成员信息
|
/// </summary>
|
private AccountInfoResult accountResult = null;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
/// <param name="i_accountResult">账号信息</param>
|
public void ShowForm(AccountInfoResult i_accountResult)
|
{
|
this.ScrollLeftEnabled = false;
|
|
this.accountResult = i_accountResult;
|
|
//过户
|
base.SetTitleText(Language.StringByID(StringId.Transfer));
|
|
|
//初始化中部信息
|
this.InitMiddleFrame();
|
}
|
|
/// <summary>
|
/// 初始化中部信息
|
/// </summary>
|
private void InitMiddleFrame()
|
{
|
//清空bodyFrame
|
this.ClearBodyFrame();
|
|
//住宅的图标
|
var btnHouseIcon = new PicViewControl(93, 93);
|
btnHouseIcon.Y = Application.GetRealHeight(127);
|
btnHouseIcon.X = Application.GetRealWidth(48);
|
btnHouseIcon.BackgroundColor = CSS_Color.MainColor;
|
bodyFrameLayout.AddChidren(btnHouseIcon);
|
//住宅名字 (以中间为基准,左右间距16)
|
var btnHouseName = new NormalViewControl(bodyFrameLayout.Width / 2 - Application.GetRealWidth(16 * 2), Application.GetRealHeight(48), false);
|
btnHouseName.X = Application.GetRealWidth(16);
|
btnHouseName.Y = btnHouseIcon.Bottom + Application.GetRealHeight(10);
|
btnHouseName.IsBold = true;
|
btnHouseName.IsMoreLines = true;
|
btnHouseName.TextAlignment = TextAlignment.TopCenter;
|
btnHouseName.TextSize = CSS_FontSize.SubheadingFontSize;
|
btnHouseName.Text = Entity.DB_ResidenceData.Instance.CurrentRegion.homeName;
|
bodyFrameLayout.AddChidren(btnHouseName);
|
|
//头像
|
var imageByte = ImageUtlis.Current.ReadFile(this.accountResult.MemberHeadIcon);
|
var btnUserIcon = new ImageView();
|
btnUserIcon.Y = btnHouseIcon.Y;
|
btnUserIcon.X = bodyFrameLayout.Width - Application.GetRealWidth(48) - this.GetPictrueRealSize(93);
|
btnUserIcon.Height = this.GetPictrueRealSize(93);
|
btnUserIcon.Width = this.GetPictrueRealSize(93);
|
btnUserIcon.Radius = (uint)this.GetPictrueRealSize(93) / 2;
|
if (imageByte != null && imageByte.Length > 0)
|
{
|
btnUserIcon.ImageBytes = imageByte;
|
}
|
else
|
{
|
btnUserIcon.ImagePath = "LoginIcon/2.png";
|
}
|
bodyFrameLayout.AddChidren(btnUserIcon);
|
|
//昵称 (以中间为基准,左右间距50)
|
var btnName = new NormalViewControl(btnHouseName.Width, btnHouseName.Height, false);
|
btnName.X = bodyFrameLayout.Width - btnHouseName.X - btnHouseName.Width;
|
btnName.Y = btnHouseName.Y;
|
btnName.IsBold = true;
|
btnName.IsMoreLines = true;
|
btnName.TextAlignment = TextAlignment.TopCenter;
|
btnName.TextSize = CSS_FontSize.SubheadingFontSize;
|
btnName.Text = accountResult.MemberName;
|
bodyFrameLayout.AddChidren(btnName);
|
|
//开启连接的假想动画效果线程
|
this.StartConcetionAnimeteThread(btnHouseIcon.Right + Application.GetRealWidth(10));
|
|
//终止
|
var btnCancel = new BottomClickButton();
|
btnCancel.Y = Application.GetRealHeight(392);
|
btnCancel.TextID = StringId.Terminate;
|
bodyFrameLayout.AddChidren(btnCancel);
|
btnCancel.ButtonClickEvent += (sender, e) =>
|
{
|
this.CloseForm();
|
};
|
|
//初始化消息控件
|
this.InitMsgControl();
|
|
}
|
|
#endregion
|
|
#region ■ 假想动画___________________________
|
|
/// <summary>
|
/// 开启连接的假想动画效果线程
|
/// </summary>
|
private void StartConcetionAnimeteThread(int XX)
|
{
|
//生成点号图样
|
int pointXX = XX;
|
int pointWidth = Application.GetRealWidth(6);
|
int pointSpace = Application.GetRealWidth(5);
|
for (int i = 0; i < 7; i++)
|
{
|
var btnPoint = new NormalViewControl(pointWidth, Application.GetRealHeight(4), false);
|
btnPoint.Radius = (uint)Application.GetRealHeight(4) / 2;
|
btnPoint.BackgroundColor = 0xffd5d5d5;
|
btnPoint.Y = Application.GetRealHeight(170);
|
btnPoint.X = pointXX;
|
bodyFrameLayout.AddChidren(btnPoint);
|
pointXX = btnPoint.Right + Application.GetRealWidth(5);
|
}
|
|
var listPoint = new List<int>();
|
//跳动的间距
|
int jumpSpace = pointWidth + pointSpace;
|
for (int i = 0; i < 7; i++)
|
{
|
//X轴+Index*(图标大小+间距)
|
listPoint.Add(XX + i * jumpSpace);
|
}
|
|
var btnRound = new IconViewControl(8);
|
btnRound.Radius = (uint)btnRound.IconSize / 2;
|
btnRound.BackgroundColor = CSS_Color.AuxiliaryColor2;
|
btnRound.X = listPoint[0] - (btnRound.IconSize - pointWidth) / 2;
|
btnRound.Y = Application.GetRealHeight(169);
|
bodyFrameLayout.AddChidren(btnRound);
|
|
HdlThreadLogic.Current.RunThread(() =>
|
{
|
int index = 1;
|
while (this.Parent != null)
|
{
|
System.Threading.Thread.Sleep(500);
|
HdlThreadLogic.Current.RunMain(() =>
|
{
|
if (btnRound != null)
|
{
|
btnRound.X = listPoint[index];
|
index++;
|
if (index == listPoint.Count)
|
{
|
index = 0;
|
}
|
}
|
});
|
}
|
});
|
}
|
|
#endregion
|
|
#region ■ 执行过户___________________________
|
|
/// <summary>
|
/// 执行过户
|
/// </summary>
|
private void DoTransferResidence()
|
{
|
this.ShowProgressBar();
|
System.Threading.Thread.Sleep(1500);
|
//过户
|
bool success = new DAL.Server.HttpServerRequest().TransferResidence(this.accountResult.Account);
|
|
this.CloseProgressBar();
|
HdlThreadLogic.Current.RunMain(() =>
|
{
|
var form = new TransferResidenceResultPage();
|
form.AddForm(this.accountResult, success);
|
form.FinishEvent += () =>
|
{
|
if (success == false)
|
{
|
//重试
|
HdlThreadLogic.Current.RunThread(() =>
|
{
|
//执行过户
|
this.DoTransferResidence();
|
});
|
}
|
else
|
{
|
for (int i = 0; i < UserInfo.Current.regionList.Count; i++)
|
{
|
//移除当前住宅Id
|
if (UserInfo.Current.regionList[i].id == Entity.DB_ResidenceData.Instance.CurrentRegion.id)
|
{
|
UserInfo.Current.regionList.RemoveAt(i);
|
UserInfo.Current.SaveUserInfo();
|
break;
|
}
|
}
|
//关闭所有界面
|
HdlFormLogic.Current.CloseAllOpenForm();
|
|
if (UserInfo.Current.regionList.Count == 0)
|
{
|
//没有住宅了,返回登陆界面
|
HDLCommon.Current.Logout();
|
}
|
else
|
{
|
Entity.DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
|
Entity.DB_ResidenceData.Instance.SaveResidenceData();
|
//刷新住宅数据
|
Common.ApiUtlis.Ins.DownloadData();
|
|
//获取主页的那个容器
|
var userPage = MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1) as UserPage;
|
if (userPage != null)
|
{
|
//刷新个人中心界面
|
MainPage.CurPageIndex = 1;
|
userPage.ChoosePersonalCenter();
|
}
|
}
|
}
|
};
|
});
|
}
|
|
#endregion
|
|
#region ■ 一般方法___________________________
|
|
/// <summary>
|
/// 初始化消息控件
|
/// </summary>
|
private void InitMsgControl()
|
{
|
string msg = Language.StringByID(StringId.IsTransferingPleaseWaitting);
|
|
//正在过户给用户,请稍后...
|
var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(20), false);
|
btnMsg.Y = Application.GetRealHeight(300);
|
btnMsg.TextAlignment = TextAlignment.Center;
|
btnMsg.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
btnMsg.Text = msg;
|
bodyFrameLayout.AddChidren(btnMsg);
|
|
HdlThreadLogic.Current.RunThread(() =>
|
{
|
int timeOut = 15;
|
while (timeOut >= 0 && this.Parent != null)
|
{
|
HdlThreadLogic.Current.RunMain(() =>
|
{
|
btnMsg.Text = msg + timeOut + "s";
|
if (timeOut == 0)
|
{
|
btnMsg.Text = msg;
|
}
|
}, ShowErrorMode.NO);
|
System.Threading.Thread.Sleep(1000);
|
timeOut--;
|
}
|
if (timeOut <= 0)
|
{
|
//执行过户操作
|
this.DoTransferResidence();
|
}
|
});
|
}
|
|
#endregion
|
}
|
}
|