| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | { |
| | | /// <summary> |
| | | /// 做成一个RowLayout型的FrameLayout |
| | | /// </summary> |
| | | public class FrameRowControl : FrameLayoutControl |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | |
|
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 做成一个RowLayout型的FrameLayout
|
| | | /// </summary>
|
| | | public class FrameRowControl : FrameLayoutStatuControl
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 此控件的识别主键(自定义设置的)
|
| | | /// </summary> |
| | | /// </summary>
|
| | | public string MainKeys = string.Empty;
|
| | | /// <summary>
|
| | | /// 左偏移量,只针对内置控件有效(这是一个真实值,默认不偏移。正数为向右偏移,负数为向左偏移)
|
| | |
| | | /// 右边图标控件的大小
|
| | | /// </summary>
|
| | | private int rightIconSize = 0;
|
| | | /// <summary>
|
| | | /// 底线控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnBottomLine = null;
|
| | |
|
| | | #endregion |
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 做成一个RowLayout型的FrameLayout
|
| | | /// </summary> |
| | | /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> |
| | | public FrameRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) |
| | | { |
| | | /// </summary>
|
| | | /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param>
|
| | | public FrameRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
|
| | | {
|
| | | this.Height = ControlCommonResourse.ListViewRowHeight;
|
| | | this.Width = Application.CurrentWidth; |
| | | } |
| | | this.Width = Application.CurrentWidth;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加底线___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加底线(如果左边有图标,则先添加图标,再添加底线)
|
| | | /// </summary> |
| | | public NormalViewControl AddBottomLine()
|
| | | /// <para>添加底线(如果左边有图标,则先添加图标,再添加底线)</para>
|
| | | /// <para>它的长度为:当前控件宽度-左右固定间距-左边图片宽度(如果有)-右边的偏移量</para>
|
| | | /// </summary>
|
| | | public virtual NormalViewControl AddBottomLine()
|
| | | {
|
| | | if (this.btnBottomLine != null)
|
| | | {
|
| | | //已经添加了底线
|
| | | return btnBottomLine;
|
| | | }
|
| | | int lineWidth = this.Width - ControlCommonResourse.XXLeft * 2 - LeftOffset - RightOffset;
|
| | | int XX = ControlCommonResourse.XXLeft + LeftOffset;
|
| | | if (leftIconSize > 0)
|
| | |
| | | lineWidth = lineWidth - leftIconSize - Application.GetRealWidth(35);
|
| | | XX = XX + leftIconSize + Application.GetRealWidth(35);
|
| | | }
|
| | | var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
|
| | | btnLine.X = XX;
|
| | | btnLine.Y = this.Height - ControlCommonResourse.BottomLineHeight;
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | base.AddChidren(btnLine);
|
| | | this.btnBottomLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
|
| | | btnBottomLine.X = XX;
|
| | | btnBottomLine.Y = this.Height - ControlCommonResourse.BottomLineHeight;
|
| | | btnBottomLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | base.AddChidren(btnBottomLine);
|
| | |
|
| | | return btnLine;
|
| | | return btnBottomLine;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// <param name="i_caption">内容</param>
|
| | | /// <param name="i_width">宽度</param>
|
| | | /// <param name="real">是否计算真实值</param>
|
| | | /// <returns></returns> |
| | | /// <returns></returns>
|
| | | public NormalViewControl AddLeftCaption(string i_caption, int i_width, bool real = true)
|
| | | {
|
| | | if (real == true)
|
| | |
| | | i_width = Application.GetRealWidth(i_width);
|
| | | }
|
| | | var contr = this.AddLeftCaption(i_caption, i_width, this.Height, false);
|
| | | this.AddChidren(contr, ChidrenBindMode.BindEventOnly);
|
| | | this.AddChidren(contr, ChidrenBindMode.BindEvent);
|
| | | if (chidrenYaxis != 0)
|
| | | {
|
| | | contr.Y += chidrenYaxis;
|
| | |
| | | /// <param name="i_width">宽度</param>
|
| | | /// <param name="i_height">高度</param>
|
| | | /// <param name="real">是否计算真实值</param>
|
| | | /// <returns></returns> |
| | | /// <returns></returns>
|
| | | public NormalViewControl AddLeftCaption(string i_caption, int i_width, int i_height, bool real = true)
|
| | | {
|
| | | int XX = ControlCommonResourse.XXLeft + LeftOffset;
|
| | |
| | | {
|
| | | XX += this.leftIconSize + Application.GetRealWidth(35);
|
| | | }
|
| | | var btnCaption = new NormalViewControl(i_width, real);
|
| | | var btnCaption = new NormalViewControl(i_width, i_height, real);
|
| | | btnCaption.X = XX;
|
| | |
|
| | | btnCaption.Height = i_height;
|
| | | btnCaption.Text = i_caption;
|
| | |
|
| | | return btnCaption;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加左边输入框_____________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加左边输入框(如果有图标,则先添加图标,再添加输入框)
|
| | | /// </summary>
|
| | | /// <param name="i_txtValue">初始内容</param>
|
| | | /// <param name="i_width">宽度</param>
|
| | | /// <param name="real">是否计算真实值</param>
|
| | | /// <returns></returns>
|
| | | public TextInputControl AddLeftInput(string i_txtValue, int i_width, bool real = true)
|
| | | {
|
| | | if (real == true)
|
| | | {
|
| | | i_width = Application.GetRealWidth(i_width);
|
| | | }
|
| | | int XX = ControlCommonResourse.XXLeft + LeftOffset;
|
| | | if (this.leftIconSize > 0)
|
| | | {
|
| | | XX += this.leftIconSize + Application.GetRealWidth(35);
|
| | | }
|
| | | var contr = new TextInputControl(i_width, this.Height, false);
|
| | | contr.Text = i_txtValue;
|
| | | contr.X = XX;
|
| | |
|
| | | this.AddChidren(contr, ChidrenBindMode.NotBind);
|
| | | if (chidrenYaxis != 0)
|
| | | {
|
| | | contr.Y += chidrenYaxis;
|
| | | }
|
| | |
|
| | | return contr;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// 添加左边图标
|
| | | /// </summary>
|
| | | /// <param name="i_Iconsize">图标大小</param>
|
| | | /// <returns></returns> |
| | | /// <returns></returns>
|
| | | public IconViewControl AddLeftIcon(int i_Iconsize = 81)
|
| | | {
|
| | | var btnIcon = new IconViewControl(i_Iconsize);
|
| | | btnIcon.X = ControlCommonResourse.XXLeft + LeftOffset;
|
| | | btnIcon.Gravity = Gravity.CenterVertical;
|
| | | this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
|
| | | this.AddChidren(btnIcon, ChidrenBindMode.BindEvent);
|
| | | if (chidrenYaxis != 0)
|
| | | {
|
| | | btnIcon.Y += chidrenYaxis;
|
| | |
| | | /// <summary>
|
| | | /// 添加向右的图标
|
| | | /// </summary>
|
| | | public IconViewControl AddRightIconControl()
|
| | | public IconViewControl AddRightArrow()
|
| | | {
|
| | | var btnRight = new IconViewControl(58);
|
| | | btnRight.Gravity = Gravity.CenterVertical;
|
| | | btnRight.X =this.Width - btnRight.IconSize - ControlCommonResourse.XXLeft + RightOffset;
|
| | | btnRight.UnSelectedImagePath = "Item/Next.png";
|
| | | this.AddChidren(btnRight, ChidrenBindMode.BindEventOnly);
|
| | | btnRight.UnSelectedImagePath = "Item/RightNext.png";
|
| | | this.AddChidren(btnRight, ChidrenBindMode.BindEvent);
|
| | |
|
| | | if (chidrenYaxis != 0)
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 添加最右边的空白图片控件
|
| | | /// </summary>
|
| | | /// <param name="i_width">控件空度(非真实值)</param> |
| | | /// <param name="i_width">控件空度(非真实值)</param>
|
| | | /// <param name="i_height">控件高度(非真实值)</param>
|
| | | /// <returns></returns>
|
| | | public MostRightIconControl AddMostRightEmptyIcon(int i_width, int i_height)
|
| | | {
|
| | | var btnContr = new MostRightIconControl(i_width, i_height);
|
| | | btnContr.UseClickStatu = false;
|
| | | this.AddChidren(btnContr, ChidrenBindMode.NotBind);
|
| | | btnContr.InitControl();
|
| | | //复合控件需要特殊处理
|
| | | this.ChangedChidrenBindMode(btnContr, ChidrenBindMode.BindEventOnly);
|
| | | this.ChangedChidrenBindMode(btnContr, ChidrenBindMode.BindEvent);
|
| | | if (RightOffset != 0)
|
| | | {
|
| | | btnContr.X += RightOffset;
|
| | | }
|
| | |
|
| | | this.rightIconSize = Application.GetMinRealAverage(i_width);
|
| | | this.rightIconSize = this.GetPictrueRealSize(i_width);
|
| | | if (chidrenYaxis != 0)
|
| | | {
|
| | | btnContr.Y += chidrenYaxis;
|
| | | btnContr.btnIcon.Y += chidrenYaxis;
|
| | | }
|
| | |
|
| | | return btnContr;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加右边的开关图标_________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加右边的开关图标
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public MostRightIconControl AddMostRightSwitchIcon()
|
| | | {
|
| | | var btnSwitch = this.AddMostRightEmptyIcon(104, 63);
|
| | | this.ChangedChidrenBindMode(btnSwitch, ChidrenBindMode.NotBind);
|
| | | btnSwitch.UnSelectedImagePath = "Item/Switch2.png";
|
| | | btnSwitch.SelectedImagePath = "Item/Switch2Selected.png";
|
| | |
|
| | | return btnSwitch;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | {
|
| | | i_width = Application.GetRealWidth(i_width);
|
| | | }
|
| | | var btnContr = new NormalViewControl(i_width, false);
|
| | | btnContr.X = this.Width - ControlCommonResourse.XXLeft - i_width - rightIconSize + RightOffset;
|
| | | btnContr.Height = this.Height;
|
| | | btnContr.TextAlignment = TextAlignment.CenterRight;
|
| | | btnContr.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnContr.Text = i_text;
|
| | | this.AddChidren(btnContr, ChidrenBindMode.BindEventOnly);
|
| | | var btnContr = AddMostRightView(i_text, i_width, this.Height, false);
|
| | | this.AddChidren(btnContr, ChidrenBindMode.BindEvent);
|
| | | if (chidrenYaxis != 0)
|
| | | {
|
| | | btnContr.Y += chidrenYaxis;
|
| | |
| | | return btnContr;
|
| | | }
|
| | |
|
| | | #endregion |
| | | } |
| | | } |
| | | /// <summary>
|
| | | /// 添加最右的显示文本,此方法不会主动添加到父控件中(如果右边有图标的话,先添加图标后,再添加这个文本)
|
| | | /// </summary>
|
| | | /// <param name="i_caption">内容</param>
|
| | | /// <param name="i_width">宽度</param>
|
| | | /// <param name="i_height">高度</param>
|
| | | /// <param name="real">是否计算真实值</param>
|
| | | /// <returns></returns>
|
| | | public NormalViewControl AddMostRightView(string i_text, int i_width, int i_height, bool real = true)
|
| | | {
|
| | | if (real == true)
|
| | | {
|
| | | i_width = Application.GetRealWidth(i_width);
|
| | | i_height = Application.GetRealHeight(i_height);
|
| | | }
|
| | | var btnContr = new NormalViewControl(i_width, i_height, false);
|
| | | btnContr.X = this.Width - ControlCommonResourse.XXLeft - i_width - rightIconSize + RightOffset;
|
| | | btnContr.Height = i_height;
|
| | | btnContr.TextAlignment = TextAlignment.CenterRight;
|
| | | btnContr.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnContr.Text = i_text;
|
| | |
|
| | | return btnContr;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加上部的显示文本_________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加上部的显示文本(如果有图标,则先添加图标,再添加文本)
|
| | | /// </summary>
|
| | | /// <param name="i_caption">内容</param>
|
| | | /// <param name="i_width">宽度</param>
|
| | | /// <param name="real">是否计算真实值</param>
|
| | | /// <returns></returns>
|
| | | public NormalViewControl AddTopView(string i_caption, int i_width, bool real = true)
|
| | | {
|
| | | if (real == true)
|
| | | {
|
| | | i_width = Application.GetRealWidth(i_width);
|
| | | }
|
| | | var contr = this.AddLeftCaption(i_caption, i_width, Application.GetRealHeight(60), false);
|
| | | contr.TextSize = 15;
|
| | | //当指定实际坐标时,这里需要的偏移量为2倍
|
| | | contr.Y = Application.GetRealHeight(12) + this.chidrenYaxis * 2;
|
| | | this.AddChidren(contr, ChidrenBindMode.BindEvent);
|
| | |
|
| | | return contr;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 添加下部的显示文本_________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加下部的显示文本(如果有图标,则先添加图标,再添加文本)
|
| | | /// </summary>
|
| | | /// <param name="i_caption">内容</param>
|
| | | /// <param name="i_width">宽度</param>
|
| | | /// <param name="real">是否计算真实值</param>
|
| | | /// <returns></returns>
|
| | | public NormalViewControl AddBottomView(string i_caption, int i_width, bool real = true)
|
| | | {
|
| | | if (real == true)
|
| | | {
|
| | | i_width = Application.GetRealWidth(i_width);
|
| | | }
|
| | | var contr = this.AddLeftCaption(i_caption, i_width, Application.GetRealHeight(50), false);
|
| | | //当指定实际坐标时,这里需要的偏移量为2倍
|
| | | contr.Y = Application.GetRealHeight(72) + this.chidrenYaxis * 2;
|
| | | contr.TextSize = 12;
|
| | | contr.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | this.AddChidren(contr, ChidrenBindMode.BindEvent);
|
| | |
|
| | | return contr;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|