using System;
|
using Shared.Common;
|
using Shared.Phone.UserView;
|
using Shared.Phone.Device.CommonForm;
|
|
namespace Shared.Phone.Device.Account
|
{
|
/// <summary>
|
/// 登录界面
|
/// </summary>
|
public class AccountLogin : FrameLayout
|
{
|
#region ◆ 变量____________________________
|
/// <summary>
|
/// 背景视图
|
/// </summary>
|
private FrameLayout midFrameLayout;
|
/// <summary>
|
/// 手机邮箱
|
/// </summary>
|
private PhoneEmailForm phoneEmailForm;
|
/// <summary>
|
/// phoneRowForm
|
/// </summary>
|
private PhoneLoginRowForm phoneRow;
|
/// <summary>
|
/// emailRow
|
/// </summary>
|
private EmailLoginRowForm emailRow;
|
/// <summary>
|
/// pwdRow
|
/// </summary>
|
private PwdLoginRowForm pwdRow;
|
|
/// <summary>
|
/// 账号密码fl
|
/// </summary>
|
private FrameLayout accountPwdFL;
|
/// <summary>
|
/// 登录错误提示按钮
|
/// </summary>
|
private Button loginErrorBtn;
|
/// <summary>
|
/// 忘记密码按钮
|
/// </summary>
|
private Button forgotPasswordBtn;
|
/// <summary>
|
/// 登录按钮
|
/// </summary>
|
private Button loginBtn;
|
/// <summary>
|
/// 验证码登录按钮
|
/// </summary>
|
private Button loginByCodeBtn;
|
/// <summary>
|
/// 注册按钮
|
/// </summary>
|
private Button registerBtn;
|
/// <summary>
|
/// 账号
|
/// </summary>
|
private string account;
|
/// <summary>
|
/// 密码
|
/// </summary>
|
private string password;
|
/// <summary>
|
/// wechat
|
/// </summary>
|
private Button wechatBtn;
|
/// <summary>
|
/// qq
|
/// </summary>
|
private Button qqBtn;
|
|
|
#endregion
|
|
#region ◆ 构造方法_________________________
|
|
/// <summary>
|
/// 构造方法
|
/// </summary>
|
public AccountLogin()
|
{
|
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
Tag = "Login";
|
}
|
|
public override void RemoveFromParent()
|
{
|
base.RemoveFromParent();
|
}
|
|
#endregion
|
|
#region ◆ 显示界面_________________________
|
|
/// <summary>
|
/// 显示界面
|
/// </summary>
|
/// <param name="account">Account.</param>
|
/// <param name="password">Password.</param>
|
public void Show(string account = "", string password = "")
|
{
|
if (Config.Instance.IsLogin)
|
{
|
|
}
|
else
|
{
|
LoginViewShow(account, password);
|
}
|
}
|
|
/// <summary>
|
/// Logins the view show.
|
/// </summary>
|
/// <param name="account">Account.</param>
|
/// <param name="password">Password.</param>
|
public void LoginViewShow(string account = "", string password = "")
|
{
|
this.account = account;
|
this.password = password;
|
#region midFrameLayout
|
midFrameLayout = new FrameLayout()
|
{
|
Width = LayoutParams.MatchParent,
|
Height = Application.GetRealHeight(CommonPage.AppRealHeight),
|
BackgroundColor =ZigbeeColor.Current.GXCBackgroundColor
|
};
|
AddChidren(midFrameLayout);
|
#endregion
|
|
#region 布局账户,密码,忘记密码,注册 手机验证码登录
|
|
var logoBG = new Button()
|
{
|
Height = Application.GetRealHeight(619),
|
UnSelectedImagePath = "Account/Logo_loginBG.png"
|
};
|
midFrameLayout.AddChidren(logoBG);
|
|
var phoneEmailBGFL = new FrameLayout()
|
{
|
Y = logoBG.Bottom,
|
Height = Application.GetRealHeight(1921),
|
BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor
|
};
|
midFrameLayout.AddChidren(phoneEmailBGFL);
|
|
var logo = new Button()
|
{
|
Width = Application.GetMinRealAverage(184),
|
Height = Application.GetMinRealAverage(184),
|
Y = Application.GetRealHeight(230),
|
UnSelectedImagePath = "Account/Logo_White.png",
|
Gravity = Gravity.CenterHorizontal
|
};
|
midFrameLayout.AddChidren(logo);
|
|
var logoName = new Button()
|
{
|
Y = logo.Bottom,
|
Height = Application.GetRealHeight(69),
|
Width = Application.GetRealWidth(300),
|
Gravity = Gravity.CenterHorizontal,
|
TextID = R.MyInternationalizationString.AppName,
|
TextColor = ZigbeeColor.Current.GXCTextWhiteColor
|
};
|
midFrameLayout.AddChidren(logoName);
|
|
phoneEmailForm = new PhoneEmailForm();
|
phoneEmailForm.Init(midFrameLayout);
|
|
//错误提示Btn
|
loginErrorBtn = new Button()
|
{
|
X = Application.GetRealWidth(242),
|
Y = Application.GetRealHeight(740),
|
Width = Application.GetRealWidth(700),
|
Height = Application.GetRealHeight(58),
|
TextColor = ZigbeeColor.Current.GXCTextRed,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
midFrameLayout.AddChidren(loginErrorBtn);
|
|
accountPwdFL = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(801),
|
Height = Application.GetRealHeight(553),
|
Width = Application.GetRealWidth(942),
|
Gravity = Gravity.CenterHorizontal,
|
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
|
Radius = (uint)Application.GetRealHeight(17)
|
};
|
midFrameLayout.AddChidren(accountPwdFL);
|
|
AddPhoneOrEmailFL(accountPwdFL, "Phone");
|
|
forgotPasswordBtn = new Button()
|
{
|
X = Application.GetRealWidth(CommonPage.AppRealWidth - 115 - 250),
|
Y = Application.GetRealHeight(1198),
|
Width = Application.GetRealWidth(250),
|
Height = Application.GetRealHeight(58),
|
TextID = R.MyInternationalizationString.ForgotPWD,
|
TextSize = CommonFormResouce.loginTextSize,
|
TextColor = Shared.Common.ZigbeeColor.Current.GXCTextGrayColor,
|
TextAlignment = TextAlignment.CenterRight
|
};
|
midFrameLayout.AddChidren(forgotPasswordBtn);
|
|
loginBtn = new Button()
|
{
|
Y = Application.GetRealHeight(1293),
|
Width = Application.GetRealWidth(688),
|
Height = Application.GetRealHeight(127),
|
Gravity = Gravity.CenterHorizontal,
|
TextID = R.MyInternationalizationString.Login,
|
TextSize = 15,
|
TextColor = ZigbeeColor.Current.GXCTextGrayColor,
|
SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor,
|
SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonBlackSelectedColor,
|
BackgroundColor = ZigbeeColor.Current.GXCButtonUnSelectedColor,
|
Radius = (uint)Application.GetRealHeight(127 / 2),
|
Enable = !string.IsNullOrEmpty(pwdRow.PasswrodET?.Text),
|
IsSelected = !string.IsNullOrEmpty(pwdRow.PasswrodET?.Text)
|
};
|
midFrameLayout.AddChidren(loginBtn);
|
|
loginByCodeBtn = new Button()
|
{
|
X=Application.GetRealWidth(98),
|
Y = Application.GetRealHeight(1466),
|
Width = Application.GetRealWidth(300),
|
Height = Application.GetRealHeight(49),
|
TextID = R.MyInternationalizationString.LoginByCode,
|
TextColor = ZigbeeColor.Current.GXCTextGrayColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = CommonFormResouce.loginTextSize
|
};
|
midFrameLayout.AddChidren(loginByCodeBtn);
|
|
registerBtn = new Button()
|
{
|
X = Application.GetRealWidth(738),
|
Y = Application.GetRealHeight(1466),
|
Width = Application.GetRealWidth(244),
|
Height = Application.GetRealHeight(49),
|
TextID = R.MyInternationalizationString.Register,
|
TextColor = ZigbeeColor.Current.GXCTextGrayColor,
|
TextAlignment = TextAlignment.CenterRight,
|
TextSize = CommonFormResouce.loginTextSize
|
};
|
midFrameLayout.AddChidren(registerBtn);
|
|
wechatBtn = new Button
|
{
|
X = Application.GetRealWidth(395),
|
Y = Application.GetRealHeight(1737),
|
Width = Application.GetMinRealAverage(115),
|
Height = Application.GetMinRealAverage(115),
|
UnSelectedImagePath = "Account/Wechat.png",
|
Gravity=Gravity.CenterHorizontal
|
};
|
midFrameLayout.AddChidren(wechatBtn);
|
|
qqBtn = new Button
|
{
|
X = Application.GetRealWidth(567),
|
Y = Application.GetRealHeight(1737),
|
Width = Application.GetMinRealAverage(115),
|
Height = Application.GetMinRealAverage(115),
|
UnSelectedImagePath = "Account/QQ.png"
|
};
|
//midFrameLayout.AddChidren(qqBtn);
|
|
#endregion
|
|
BindEvent();
|
}
|
|
#endregion
|
|
#region ◆ 绑定事件_________________________
|
|
/// <summary>
|
/// 绑定按钮事件
|
/// </summary>
|
private void BindEvent()
|
{
|
//选择手机邮箱
|
phoneEmailForm.SelectedPhone.MouseUpEventHandler += SelectPhoneOrEmail_MouseUpEvent;
|
phoneEmailForm.SelectedEmail.MouseUpEventHandler += SelectPhoneOrEmail_MouseUpEvent;
|
//登录事件
|
loginBtn.MouseUpEventHandler += LoginBtnEvent;
|
//短信登录
|
loginByCodeBtn.MouseUpEventHandler += LoginByCode;
|
//注册事件
|
registerBtn.MouseUpEventHandler += Register;
|
//忘记密码
|
forgotPasswordBtn.MouseUpEventHandler += ForgetPWD_MouseUpEvent;
|
//wechat
|
wechatBtn.MouseUpEventHandler += LoginByWechat;
|
//qq
|
qqBtn.MouseUpEventHandler += LoginByQQ;
|
}
|
|
#endregion
|
|
#region ◆ 登录____________________________
|
|
/// <summary>
|
/// 登录事件
|
/// </summary>
|
/// <param name="sender">Sender.</param>
|
/// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
|
private void LoginBtnEvent(object sender,MouseEventArgs mouseEventArgs)
|
{
|
if (phoneEmailForm.SelectedPhone.IsSelected)
|
{
|
Login(phoneRow.AccountET.Text.Trim(), pwdRow.PasswrodET.Text.Trim());
|
}
|
else
|
{
|
Login(emailRow.AccountET.Text.Trim(), pwdRow.PasswrodET.Text.Trim());
|
}
|
|
}
|
|
/// <summary>
|
/// 登录
|
/// </summary>
|
/// <param name="accountStr">Account.</param>
|
/// <param name="passwordStr">Password.</param>
|
private void Login(string accountStr, string passwordStr)
|
{
|
//Application.RunOnMainThread( () =>
|
//{
|
Action action = async () =>
|
{
|
try
|
{
|
CommonPage.Loading.Start(Language.StringByID(R.MyInternationalizationString.Logining));
|
|
var requestObj = new SendDataToServer.LoginObj
|
{
|
Account = accountStr,
|
Password = passwordStr,
|
Source = CommonPage.Source,
|
Company = CommonPage.Company
|
};
|
var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
|
var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/Login", System.Text.Encoding.UTF8.GetBytes(requestJson));
|
if (revertObj == null)
|
{
|
CommonPage.Instance.FailureToServer();
|
CommonPage.Loading.Hide();
|
return;
|
}
|
var stateCodeStr = revertObj.StateCode.ToUpper();
|
//Error 不能直接从服务器取,只能根据状态码逐一判断
|
if (stateCodeStr == "SUCCESS")
|
{
|
if (revertObj.ResponseData == null)
|
{
|
return;
|
}
|
|
HomePage.Instance.ShowLoginLoadView();
|
|
new System.Threading.Thread(async () =>
|
{
|
//存储数据
|
var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
|
var revertData = responseDataObj;
|
Config.ReFresh();
|
Config.Instance.Account = revertData.Account;
|
Config.Instance.MqttKey = revertData.MqttKey;
|
Config.Instance.Password = passwordStr;
|
Config.Instance.MD5PWD = revertData.MD5PWD;
|
Config.Instance.Guid = revertData.Guid;
|
Config.Instance.LoginDateTime = DateTime.Now;
|
Config.Instance.ConnectZigbeeMqttBrokerPwd = revertData.ConnectZigbeeMqttBrokerPwd;
|
Config.Instance.ConnectZigbeeMqttClientId = revertData.ConnectZigbeeMqttClientId;
|
Config.Instance.ZigbeeMqttBrokerLoadSubDomain = revertData.ZigbeeMqttBrokerLoadSubDomain;
|
if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null)
|
{
|
Config.Instance.AccountList.Add(revertData.Account);
|
}
|
Config.Instance.Save();
|
|
var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
|
var homes = await House.GetHomeLists();
|
//启动ZigBee
|
ZigBee.Common.Application.Init();
|
//刷新个人中心的内存及线程
|
await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
|
Shared.Common.Room.InitAllRoom();
|
Application.RunOnMainThread(() =>
|
{
|
CommonPage.Loading.Hide();
|
this.RemoveFromParent();
|
CommonPage.Instance.RemoveViewByTag("Login");
|
UserPage.Instance.Fresh();
|
});
|
})
|
{ IsBackground = true }.Start();
|
}
|
else if (stateCodeStr == "NOTVERIFY")
|
{
|
CommonPage.Loading.Hide();
|
//未激活
|
loginErrorBtn.TextID = R.MyInternationalizationString.NOTVERIFY;
|
}
|
else if (stateCodeStr == "NOTENABLE")
|
{
|
CommonPage.Loading.Hide();
|
//该用户属于调试账号,并未启用
|
loginErrorBtn.TextID = R.MyInternationalizationString.NOTENABLE;
|
}
|
else if (stateCodeStr == "USERNAMEORPWDERROR")
|
{
|
CommonPage.Loading.Hide();
|
//账号或密码错误
|
loginErrorBtn.TextID = R.MyInternationalizationString.USERNAMEORPWDERROR;
|
}
|
else if (stateCodeStr == "ACCOUNTNOEXISTS")
|
{
|
CommonPage.Loading.Hide();
|
//账号不存在
|
loginErrorBtn.TextID = R.MyInternationalizationString.ACCOUNTNOEXISTS;
|
}
|
else if (stateCodeStr == "YOUDATANOISLOCALREGION")
|
{
|
CommonPage.Loading.Hide();
|
//不在本区域,需要重定向区域后再次请求登录
|
if (revertObj.ResponseData == null)
|
{
|
return;
|
}
|
var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginLocalRegionRes>(revertObj.ResponseData.ToString());
|
CommonPage.RequestHttpsHost = responseDataObj.RegionServer;
|
//再次登录
|
Login(accountStr, passwordStr);
|
}
|
else
|
{
|
loginErrorBtn.TextID = R.MyInternationalizationString.RequestServerFailed;
|
}
|
}
|
catch (Exception ex)
|
{
|
System.Console.WriteLine($"登录失败--{ex.Message}");
|
CommonPage.Loading.Hide();
|
CommonPage.Instance.FailureToServer();
|
}
|
finally
|
{
|
//CommonPage.Loading.Hide();
|
}
|
//});
|
};
|
action();
|
}
|
|
/// <summary>
|
/// 通过验证码登录
|
/// </summary>
|
/// <param name="sender">Sender.</param>
|
/// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
|
private void LoginByCode(object sender,MouseEventArgs mouseEventArgs)
|
{
|
//this.RemoveFromParent();
|
var loginByCodePage = new AccountLoginByCode();
|
CommonPage.Instance.AddChidren(loginByCodePage);
|
loginByCodePage.Show();
|
}
|
|
/// <summary>
|
/// wechat登录
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="mouseEventArgs"></param>
|
private void LoginByWechat(object sender, MouseEventArgs mouseEventArgs)
|
{
|
#if Android
|
//var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP),
|
// Language.StringByID(R.MyInternationalizationString.LoginByWechat),
|
// Language.StringByID(R.MyInternationalizationString.Cancel),
|
// Language.StringByID(R.MyInternationalizationString.Confrim));
|
//alert.Show();
|
//alert.ResultEventHandler += (send, e) =>
|
//{
|
//if (e)
|
//{
|
com.hdl.home.Application.WXLogin();
|
com.hdl.home.WXEntryActivity.RespAction = (authStr) =>
|
{
|
if (authStr == null)
|
{
|
|
}
|
else
|
{
|
new System.Threading.Thread(async () =>
|
{
|
var re = await isBindAuthAsync(authStr);
|
if (re)
|
{
|
//直接登录
|
HomePage.Instance.ShowLoginLoadView();
|
var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
|
var homes = await House.GetHomeLists();
|
//启动ZigBee
|
ZigBee.Common.Application.Init();
|
//刷新个人中心的内存及线程
|
await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
|
Shared.Common.Room.InitAllRoom();
|
Application.RunOnMainThread(() =>
|
{
|
this.RemoveFromParent();
|
CommonPage.Instance.RemoveViewByTag("Login");
|
UserPage.Instance.Fresh();
|
});
|
}
|
else
|
{
|
var authRes = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.AuthUserRes>(authStr);
|
Application.RunOnMainThread(() =>
|
{
|
var registerPage = new AccountRegister();
|
Shared.Common.CommonPage.Instance.AddChidren(registerPage);
|
registerPage.OpenID = authRes.openid;
|
registerPage.Show();
|
});
|
}
|
})
|
{ IsBackground = true }.Start();
|
}
|
};
|
//}
|
//};
|
#endif
|
|
#if iOS
|
Home.IOS.AppDelegate.WXLogin();
|
Home.IOS.AppDelegate.RespAction = (authStr) =>
|
{
|
if (authStr == null)
|
{
|
|
}
|
else
|
{
|
new System.Threading.Thread(async () =>
|
{
|
|
var re = await isBindAuthAsync(authStr);
|
if (re)
|
{
|
//直接登录
|
//this.RemoveFromParent();
|
|
//UserPage.Instance.Fresh();
|
var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
|
var homes = await House.GetHomeLists();
|
//启动ZigBee
|
ZigBee.Common.Application.Init();
|
//刷新个人中心的内存及线程
|
await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
|
Shared.Common.Room.InitAllRoom();
|
Application.RunOnMainThread(() =>
|
{
|
this.RemoveFromParent();
|
UserPage.Instance.Fresh();
|
});
|
}
|
else
|
{
|
var authRes = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.AuthUserRes>(authStr);
|
Application.RunOnMainThread(() =>
|
{
|
var registerPage = new AccountRegister();
|
Shared.Common.CommonPage.Instance.AddChidren(registerPage);
|
registerPage.OpenID = authRes.openid;
|
registerPage.Show();
|
});
|
}
|
})
|
{ IsBackground = true }.Start();
|
}
|
};
|
#endif
|
|
|
|
}
|
|
/// <summary>
|
/// qq登录
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="mouseEventArgs"></param>
|
private void LoginByQQ(object sender, MouseEventArgs mouseEventArgs)
|
{
|
|
}
|
|
/// <summary>
|
/// 是否已绑定
|
/// </summary>
|
/// <param name="authStr"></param>
|
/// <returns></returns>
|
private async System.Threading.Tasks.Task<bool> isBindAuthAsync(string authStr)
|
{
|
var authRes = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.AuthUserRes>(authStr);
|
var auth = new SendDataToServer.AuthUser()
|
{
|
AccessToken = authRes.access_token,
|
RefreshToken = authRes.refresh_token,
|
OpenID = authRes.openid
|
};
|
var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(auth);
|
var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/InsertOrUpdateAuthUser", System.Text.Encoding.UTF8.GetBytes(requestJson));
|
if (revertObj == null)
|
{
|
return false;
|
}
|
var stateCodeStr = revertObj.StateCode.ToUpper();
|
if (stateCodeStr == "SUCCESS")
|
{
|
var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
|
var revertData = responseDataObj;
|
Config.Instance.Account = revertData.Account;
|
Config.Instance.MD5PWD = revertData.MD5PWD;
|
Config.Instance.Guid = revertData.Guid;
|
Config.Instance.MqttKey = revertData.MqttKey;
|
Config.Instance.LoginDateTime = DateTime.Now;
|
Config.Instance.ConnectZigbeeMqttBrokerPwd = revertData.ConnectZigbeeMqttBrokerPwd;
|
Config.Instance.ConnectZigbeeMqttClientId = revertData.ConnectZigbeeMqttClientId;
|
Config.Instance.ZigbeeMqttBrokerLoadSubDomain = revertData.ZigbeeMqttBrokerLoadSubDomain;
|
if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null)
|
{
|
Config.Instance.AccountList.Add(revertData.Account);
|
}
|
Config.Instance.Save();
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
|
|
/// <summary>
|
/// phone/email 选择
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="mouseEventArgs"></param>
|
private void SelectPhoneOrEmail_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
|
{
|
phoneEmailForm.SelectedPhone.IsSelected = phoneEmailForm.SelectedEmail.IsSelected = false;
|
loginBtn.Enable = loginBtn.IsSelected = false;
|
(sender as Button).IsSelected = true;
|
if((sender as Button).Tag.ToString()=="Phone")
|
{
|
AddPhoneOrEmailFL(accountPwdFL, "Phone");
|
}
|
else
|
{
|
AddPhoneOrEmailFL(accountPwdFL, "Email");
|
}
|
}
|
/// <summary>
|
/// AddPhoneOrEmailFL
|
/// </summary>
|
/// <param name="accountPwdFrameLayout"></param>
|
/// <param name="phoneOrEmail"></param>
|
private void AddPhoneOrEmailFL(FrameLayout accountPwdFrameLayout,string phoneOrEmail)
|
{
|
accountPwdFrameLayout.RemoveAll();
|
|
if (phoneOrEmail == "Phone")
|
{
|
phoneRow = new PhoneLoginRowForm();
|
phoneRow.Init(accountPwdFrameLayout, this, this.account, 29, 29);
|
phoneRow.AccountET.TextChangeEventHandler += Account_TextChange;
|
}
|
else
|
{
|
emailRow = new EmailLoginRowForm();
|
emailRow.Init(accountPwdFrameLayout, this.account, 29, 29);
|
emailRow.AccountET.TextChangeEventHandler += Account_TextChange;
|
}
|
|
pwdRow = new PwdLoginRowForm();
|
pwdRow.Init(accountPwdFrameLayout, 29, 225);
|
pwdRow.PasswrodET.TextChangeEventHandler += Pwd_TextChange;
|
|
|
}
|
#endregion
|
|
|
#region ◆ 忘记密码________________________
|
/// <summary>
|
/// 忘记密码
|
/// </summary>
|
private void ForgetPWD_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
|
{
|
var forgot = new AccountForgetPWD();
|
CommonPage.Instance.AddChidren(forgot);
|
forgot.Show();
|
}
|
|
#endregion
|
|
#region ◆ 注册_____________________________
|
|
/// <summary>
|
/// 注册
|
/// </summary>
|
/// <param name="sender">Sender.</param>
|
/// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
|
private void Register(object sender,MouseEventArgs mouseEventArgs)
|
{
|
var registerPage = new AccountRegister();
|
Shared.Common.CommonPage.Instance.AddChidren(registerPage);
|
registerPage.Show();
|
}
|
|
#endregion
|
|
#region ◆ 账号密码监听______________________
|
/// <summary>
|
/// 账号监听
|
/// </summary>
|
/// <param name="sender">Sender.</param>
|
/// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
|
private void Account_TextChange(object sender,string mouseEventArgs)
|
{
|
loginErrorBtn.Text = "";
|
}
|
|
/// <summary>
|
/// 密码监听事件
|
/// </summary>
|
/// <param name="sender">Sender.</param>
|
/// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
|
private void Pwd_TextChange(object sender,string mouseEventArgs)
|
{
|
loginErrorBtn.Text = "";
|
if (1 <= pwdRow.PasswrodET.Text.Trim().Length && pwdRow.PasswrodET.Text.Trim().Length <= 16 && (phoneRow.AccountET.Text.Trim().Length > 0 || emailRow.AccountET.Text.Trim().Length>0))
|
{
|
loginBtn.Enable = loginBtn.IsSelected = true;
|
}
|
else if (pwdRow.PasswrodET.Text.Trim().Length > 16)
|
{
|
pwdRow.PasswrodET.Text = mouseEventArgs.Remove(16);
|
}
|
else if (pwdRow.PasswrodET.Text.Trim().Length > 16 && phoneRow.AccountET.Text.Trim().Length > 0)
|
{
|
loginBtn.Enable = loginBtn.IsSelected = true;
|
pwdRow.PasswrodET.Text = mouseEventArgs.Remove(16);
|
}
|
else
|
{
|
loginBtn.Enable = loginBtn.IsSelected = false;
|
}
|
}
|
|
|
#endregion
|
|
}
|
}
|