old mode 100755
new mode 100644
| | |
| | | public class SearchTextControl : FrameLayout |
| | | { |
| | | #region ■ 变量声明__________________________ |
| | | /// <summary>
|
| | | /// 为了对应子线程
|
| | | /// <summary> |
| | | /// 为了对应子线程 |
| | | /// </summary> |
| | | private string m_Text = string.Empty; |
| | | /// <summary> |
| | |
| | | public string Text |
| | | { |
| | | get |
| | | {
|
| | | { |
| | | return m_Text; |
| | | } |
| | | set
|
| | | {
|
| | | this.m_Text = value;
|
| | | txtSearch.Text = this.m_Text;
|
| | | set |
| | | { |
| | | this.m_Text = value; |
| | | txtSearch.Text = this.m_Text; |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | /// 回调函数 |
| | | /// </summary> |
| | | private Action<string> actionMethod = null; |
| | | /// <summary>
|
| | | /// 没有输入键值的显示文本
|
| | | /// <summary> |
| | | /// 没有输入键值的显示文本 |
| | | /// </summary> |
| | | private string tipText = string.Empty;
|
| | |
|
| | | private string tipText = string.Empty; |
| | | |
| | | #endregion |
| | |
|
| | | |
| | | #region ■ 初始化____________________________ |
| | | /// <summary> |
| | | /// 制作一个根据键值进行搜索的控件 |
| | |
| | | this.tipText = i_tipText; |
| | | //桌布控件 |
| | | this.Width = Application.GetRealWidth(width); |
| | | this.Height = Application.GetRealHeight(height);
|
| | | this.Gravity = Gravity.CenterHorizontal;
|
| | | this.Height = Application.GetRealHeight(height); |
| | | this.Gravity = Gravity.CenterHorizontal; |
| | | this.Radius = (uint)Application.GetRealHeight(17); |
| | | this.BackgroundColor = 0xfff8f7f7; |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="action">回调函数:值是输入的关键字</param> |
| | | private void InitControl(Action<string> action) |
| | | {
|
| | | //搜索图标
|
| | | var btnIcon = new IconViewControl(52);
|
| | | btnIcon.Gravity = Gravity.CenterVertical;
|
| | | btnIcon.X = ControlCommonResourse.XXLeft;
|
| | | { |
| | | //搜索图标 |
| | | var btnIcon = new IconViewControl(52); |
| | | btnIcon.Gravity = Gravity.CenterVertical; |
| | | btnIcon.X = ControlCommonResourse.XXLeft; |
| | | btnIcon.UnSelectedImagePath = "Item/Search.png"; |
| | | this.AddChidren(btnIcon);
|
| | |
|
| | | //取消
|
| | | var btnCancel = new IconViewControl(58);
|
| | | btnCancel.X = this.Width - ControlCommonResourse.XXLeft / 2 - btnCancel.IconSize;
|
| | | this.AddChidren(btnIcon); |
| | | |
| | | //取消 |
| | | var btnCancel = new IconViewControl(58); |
| | | btnCancel.X = this.Width - ControlCommonResourse.XXLeft / 2 - btnCancel.IconSize; |
| | | btnCancel.UnSelectedImagePath = "Item/CancelIcon.png"; |
| | | btnCancel.Gravity = Gravity.CenterVertical; |
| | | this.AddChidren(btnCancel); |
| | |
| | | //输入文本 |
| | | int textWidth = btnCancel.X - Application.GetRealWidth(132 + 10); |
| | | txtSearch = new TextInputControl(textWidth, Application.GetRealHeight(49), false); |
| | | txtSearch.X = Application.GetRealWidth(132);
|
| | | txtSearch.X = Application.GetRealWidth(132); |
| | | txtSearch.PlaceholderText = this.tipText; |
| | | txtSearch.Gravity = Gravity.CenterVertical; |
| | | txtSearch.TextSize = 12; |
| | | txtSearch.PlaceholderTextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | txtSearch.PlaceholderTextColor = UserCenterColor.Current.TextGrayColor1; |
| | | this.AddChidren(txtSearch); |
| | | |
| | | string oldText = string.Empty; |
| | |
| | | //允许执行回调函数 |
| | | this.isCanSearch = true; |
| | | }; |
| | | }
|
| | | } |
| | | #endregion |
| | |
|
| | | |
| | | #region ■ 绑定事件__________________________ |
| | |
|
| | | |
| | | /// <summary> |
| | | /// 绑定事件 |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | #endregion |
| | |
|
| | | |
| | | #region ■ 开启线程__________________________ |
| | |
|
| | | |
| | | /// <summary> |
| | | /// 能否执行搜索 |
| | | /// </summary> |
| | |
| | | //那就说明,用户再次输入了键值,这个时候,让线程继续跑下去 |
| | | } |
| | | }); |
| | | }
|
| | | } |
| | | #endregion |
| | |
|
| | | |
| | | #region ■ 控件摧毁__________________________ |
| | | |
| | | /// <summary>
|
| | | /// 控件摧毁
|
| | | /// <summary> |
| | | /// 控件摧毁 |
| | | /// </summary> |
| | | public override void RemoveFromParent()
|
| | | {
|
| | | actionMethod = null;
|
| | | base.RemoveFromParent();
|
| | | public override void RemoveFromParent() |
| | | { |
| | | actionMethod = null; |
| | | base.RemoveFromParent(); |
| | | } |
| | | |
| | | #endregion |