New file |
| | |
| | | using Shared.Phone.UserCenter;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
|
| | | namespace Shared.Phone.Login.Controls
|
| | | {
|
| | | /// <summary>
|
| | | /// 登陆界面的手机号和邮箱来回切换的控件
|
| | | /// </summary>
|
| | | public class PhoneEmailSelectControl : FrameLayout
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 菜单选择事件 1:手机号 2:邮箱
|
| | | /// </summary>
|
| | | public Action<int> SelectMenuEvent = null;
|
| | | /// <summary>
|
| | | /// 手机号控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnPhone = null;
|
| | | /// <summary>
|
| | | /// 邮箱控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnEmail = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 登陆界面的手机号和邮箱来回切换的控件
|
| | | /// </summary>
|
| | | public PhoneEmailSelectControl()
|
| | | {
|
| | | this.Width = HdlControlLogic.Current.GetPictrueRealSize(905);
|
| | | this.Height = HdlControlLogic.Current.GetPictrueRealSize(170);
|
| | | this.Gravity = Gravity.CenterHorizontal;
|
| | | this.BackgroundImagePath = "Account/PhoneEmail_White.png";
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化控件(索引会触发回调事件,SelectMenuEvent需要在它之前实现)
|
| | | /// </summary>
|
| | | /// <param name="selectBackColor">选择时的背景颜色</param>
|
| | | /// <param name="selectIndex">默认选择的索引 1:手机号 2:邮箱</param>
|
| | | public void InitControl(uint selectBackColor,int selectIndex)
|
| | | {
|
| | | //手机号
|
| | | this.btnPhone = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(467), HdlControlLogic.Current.GetPictrueRealSize(127), false);
|
| | | btnPhone.X = HdlControlLogic.Current.GetPictrueRealSize(10);
|
| | | btnPhone.SelectedBackgroundColor = selectBackColor;
|
| | | btnPhone.TextID = R.MyInternationalizationString.PhoneNum;
|
| | | btnPhone.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnPhone.SelectedTextColor = UserCenterColor.Current.White;
|
| | | btnPhone.TextAlignment = TextAlignment.Center;
|
| | | btnPhone.Radius = (uint)HdlControlLogic.Current.GetPictrueRealSize(127) / 2;
|
| | | this.AddChidren(btnPhone);
|
| | | btnPhone.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (btnPhone.IsSelected == false)
|
| | | {
|
| | | btnPhone.IsBold = true;
|
| | | btnPhone.IsSelected = true;
|
| | |
|
| | | btnEmail.IsBold = false;
|
| | | btnEmail.IsSelected = false;
|
| | | //调用回调函数
|
| | | this.SelectMenuEvent?.Invoke(1);
|
| | | }
|
| | | };
|
| | |
|
| | | //邮箱
|
| | | this.btnEmail = new NormalViewControl(this.btnPhone.Width, this.btnPhone.Height, false);
|
| | | btnEmail.X = this.Width - this.btnPhone.Width - HdlControlLogic.Current.GetPictrueRealSize(10);
|
| | | btnEmail.SelectedBackgroundColor = selectBackColor;
|
| | | btnEmail.TextID = R.MyInternationalizationString.Email;
|
| | | btnEmail.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnEmail.SelectedTextColor = UserCenterColor.Current.White;
|
| | | btnEmail.TextAlignment = TextAlignment.Center;
|
| | | btnEmail.Radius = (uint)HdlControlLogic.Current.GetPictrueRealSize(127) / 2;
|
| | | this.AddChidren(btnEmail);
|
| | | btnEmail.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (btnEmail.IsSelected == false)
|
| | | {
|
| | | btnPhone.IsBold = false;
|
| | | btnPhone.IsSelected = false;
|
| | |
|
| | | btnEmail.IsBold = true;
|
| | | btnEmail.IsSelected = true;
|
| | | //调用回调函数
|
| | | this.SelectMenuEvent?.Invoke(2);
|
| | | }
|
| | | };
|
| | |
|
| | | //设置选择状态
|
| | | this.SetSelectIndex(selectIndex);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 设置选择状态_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置选择状态(1:手机号 2:邮箱)
|
| | | /// </summary>
|
| | | /// <param name="i_index">1:手机号 2:邮箱</param>
|
| | | public void SetSelectIndex(int i_index)
|
| | | {
|
| | | //设置初始值
|
| | | if (i_index == 1)
|
| | | {
|
| | | btnPhone.IsBold = true;
|
| | | btnPhone.IsSelected = true;
|
| | | if (btnEmail.IsSelected == true)
|
| | | {
|
| | | btnEmail.IsBold = false;
|
| | | btnEmail.IsSelected = false;
|
| | | }
|
| | | //调用回调函数
|
| | | this.SelectMenuEvent?.Invoke(1);
|
| | | }
|
| | | else if (i_index == 2)
|
| | | {
|
| | | btnEmail.IsBold = true;
|
| | | btnEmail.IsSelected = true;
|
| | | if (btnPhone.IsSelected == true)
|
| | | {
|
| | | btnPhone.IsBold = false;
|
| | | btnPhone.IsSelected = false;
|
| | | }
|
| | | //调用回调函数
|
| | | this.SelectMenuEvent?.Invoke(2);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 控件摧毁___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 控件摧毁
|
| | | /// </summary>
|
| | | public override void RemoveFromParent()
|
| | | {
|
| | | this.SelectMenuEvent = null;
|
| | |
|
| | | base.RemoveFromParent();
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|