using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter.Residence
{
///
/// 住宅过户的主界面
///
public class TransferResidenceMainForm : EditorCommonForm
{
#region ■ 变量声明___________________________
#endregion
#region ■ 初始化_____________________________
///
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
///
public void ShowForm()
{
//设置头部信息
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uTransferOfResidence));
//初始化中部信息
this.InitMiddleFrame();
}
///
/// 初始化中部信息
///
private void InitMiddleFrame()
{
//转移图片
var btnPictrue = new PicViewControl(804, 268);
btnPictrue.Gravity = Gravity.CenterHorizontal;
btnPictrue.Y = Application.GetRealHeight(222);
btnPictrue.UnSelectedImagePath = "Item/TransferOfResidence.png";
bodyFrameLayout.AddChidren(btnPictrue);
//转移住宅到其他Evoyo Home账号
var btnMsg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(90), false);
btnMsg1.Y = Application.GetRealHeight(593);
btnMsg1.TextSize = 20;
btnMsg1.IsBold = true;
btnMsg1.TextAlignment = TextAlignment.Center;
btnMsg1.TextID = R.MyInternationalizationString.uTransferOfResidenceToOtherEvoyoAccount1;
bodyFrameLayout.AddChidren(btnMsg1);
var btnMsg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(90), false);
btnMsg2.Y = btnMsg1.Bottom;
btnMsg2.TextSize = 20;
btnMsg2.IsBold = true;
btnMsg2.TextAlignment = TextAlignment.Center;
btnMsg2.TextID = R.MyInternationalizationString.uTransferOfResidenceToOtherEvoyoAccount2;
bodyFrameLayout.AddChidren(btnMsg2);
//该操作不可逆,请注意:
var btnTip = new NormalViewControl(900, 60, true);
btnTip.X = Application.GetRealWidth(135);
btnTip.Y = btnMsg2.Bottom + Application.GetRealHeight(167);
btnTip.TextID = R.MyInternationalizationString.uThisOperationIsIrreversiblePleaseNote;
bodyFrameLayout.AddChidren(btnTip);
//1.接收方为Evoyo Home有效注册账号
var btnTipMsg1 = new NormalViewControl(900, 55, true);
btnTipMsg1.X = btnTip.X;
btnTipMsg1.Y = btnTip.Bottom + Application.GetRealHeight(30);
btnTipMsg1.TextSize = 12;
btnTipMsg1.TextColor = UserCenterColor.Current.TextGrayColor1;
btnTipMsg1.TextID = R.MyInternationalizationString.uTheReceiverIsValidAccountForEvoyoHome;
bodyFrameLayout.AddChidren(btnTipMsg1);
//2.接收方与过户方不可以为同一个账号
var btnTipMsg2 = new NormalViewControl(900, 55, true);
btnTipMsg2.X = btnTip.X;
btnTipMsg2.Y = btnTipMsg1.Bottom + Application.GetRealHeight(30);
btnTipMsg2.TextSize = 12;
btnTipMsg2.TextColor = UserCenterColor.Current.TextGrayColor1;
btnTipMsg2.TextID = R.MyInternationalizationString.uTheReceiverAndTheTransferPartyCannotBeTheSameAccount;
bodyFrameLayout.AddChidren(btnTipMsg2);
//3.过户成功后,将取消过户方成员对该住宅的使用权
var btnTipMsg3 = new NormalViewControl(900, 55, true);
btnTipMsg3.X = btnTip.X;
btnTipMsg3.Y = btnTipMsg2.Bottom + Application.GetRealHeight(30);
btnTipMsg3.TextSize = 12;
btnTipMsg3.TextColor = UserCenterColor.Current.TextGrayColor1;
btnTipMsg3.TextID = R.MyInternationalizationString.uIfTheTransferIsSuccessfulTheRightToUseTheHouseWillBeCancelled;
bodyFrameLayout.AddChidren(btnTipMsg3);
//输入账号
var btnInputAccount = new BottomClickButton(372);
btnInputAccount.Gravity = Gravity.Frame;
btnInputAccount.X = Application.GetRealWidth(115);
btnInputAccount.TextID = R.MyInternationalizationString.uInputAccount;
bodyFrameLayout.AddChidren(btnInputAccount);
btnInputAccount.ButtonClickEvent += (sender, e) =>
{
var form = new TransferResidenceByIdForm();
form.AddForm();
};
//扫描二维码的背景
var btnScanGroud = new NormalViewControl(429, 184, true);
btnScanGroud.Y = Application.GetRealHeight(1454);
btnScanGroud.X = btnInputAccount.Right + Application.GetRealWidth(78);
btnScanGroud.UnSelectedImagePath = "Item/ScanQrCodeGroud.png";
bodyFrameLayout.AddChidren(btnScanGroud);
//扫描二维码
var btnScanQrCode = new BottomClickButton(372);
btnScanQrCode.Gravity = Gravity.Frame;
btnScanQrCode.X = btnScanGroud.X + Application.GetRealWidth(28);
btnScanQrCode.TextID = R.MyInternationalizationString.uScanQRcode;
btnScanQrCode.BackgroundColor = UserCenterColor.Current.Transparent;
btnScanQrCode.UseClickStatu = false;
bodyFrameLayout.AddChidren(btnScanQrCode);
btnScanQrCode.ButtonClickEvent += (sender, e) =>
{
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),
Language.StringByID(R.MyInternationalizationString.uScanQRcode));
};
}
#endregion
#region ■ 搜索ID_____________________________
///
/// 搜索指定ID的信息
///
/// 成员ID
/// 信息控件
private void SearchMemberInfo(string accountId)
{
var pra = new AccountInfoPra();
pra.Account = accountId;
var byteData = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List() { "AccountNoExists" });
if (byteData == null)
{
//异常
return;
}
var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject(System.Text.Encoding.UTF8.GetString(byteData));
if (revertObj.StateCode == "AccountNoExists")
{
HdlThreadLogic.Current.RunMain(() =>
{
//账号信息
var form = new Member.MemberNotEsixtForm();
form.AddForm(Language.StringByID(R.MyInternationalizationString.uAccountInfo));
});
return;
}
var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject(revertObj.ResponseData.ToString());
infoResult.Account = accountId;
}
#endregion
}
}