using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace Shared.Phone.UserCenter
|
{
|
/// <summary>
|
/// 做成一个地区选择的行控件
|
/// </summary>
|
public class AreaCodeSelectRow : StatuRowLayout
|
{
|
/// <summary>
|
/// 地区信息
|
/// </summary>
|
public Common.ResponseEntity.AreaCodeOBJ codeObj = null;
|
/// <summary>
|
/// 图标控件
|
/// </summary>
|
private RowLeftIconView btnIcon = null;
|
/// <summary>
|
/// 地区名
|
/// </summary>
|
private RowCenterView btnArea = null;
|
/// <summary>
|
/// 状态
|
/// </summary>
|
private StatuMode Statu = StatuMode.UN_SELECT;
|
/// <summary>
|
/// 是否处于选择状态
|
/// </summary>
|
public bool IsSelect
|
{
|
get { return Statu == StatuMode.SELECT; }
|
set
|
{
|
if (value == false)
|
{
|
this.SetUnselectStatu();
|
}
|
else
|
{
|
this.SetSelectStatu();
|
}
|
}
|
}
|
|
/// <summary>
|
/// 做成一个地区选择的行控件
|
/// </summary>
|
/// <param name="listView">列表控件,可以为空</param>
|
/// <param name="i_codeObj"></param>
|
public AreaCodeSelectRow(VerticalScrolViewLayout listView, Common.ResponseEntity.AreaCodeOBJ i_codeObj)
|
{
|
this.codeObj = i_codeObj;
|
|
this.MouseUpEvent += (sender, e) =>
|
{
|
this.IsSelect = Statu == StatuMode.SELECT ? false : true;
|
};
|
if (listView != null)
|
{
|
listView.AddChidren(this);
|
//初始化内部控件
|
this.InitControl();
|
}
|
}
|
|
/// <summary>
|
/// 初始化内部控件
|
/// </summary>
|
public void InitControl()
|
{
|
//图标
|
btnIcon = new RowLeftIconView();
|
btnIcon.UnSelectedImagePath = "Account/Check.png";
|
btnIcon.SelectedImagePath = "Account/CheckSelected.png";
|
this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
|
|
//地区
|
btnArea = new RowCenterView();
|
btnArea.Text = this.codeObj.Name;
|
this.AddChidren(btnArea, ChidrenBindMode.BindEventOnly);
|
}
|
|
/// <summary>
|
/// 设定选择状态
|
/// </summary>
|
public void SetSelectStatu()
|
{
|
if (Statu == StatuMode.SELECT)
|
{
|
return;
|
}
|
|
btnArea.TextColor = UserCenterColor.Current.SelectTextColor;
|
btnIcon.IsSelected = true;
|
//状态变更
|
Statu = StatuMode.SELECT;
|
}
|
|
/// <summary>
|
/// 设置非选择状态
|
/// </summary>
|
public void SetUnselectStatu()
|
{
|
if (Statu == StatuMode.UN_SELECT)
|
{
|
return;
|
}
|
btnArea.TextColor = UserCenterColor.Current.TextColor;
|
btnIcon.IsSelected = false;
|
//状态变更
|
Statu = StatuMode.UN_SELECT;
|
}
|
}
|
}
|