using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter
{
///
/// 做成一个地区选择的行控件
///
public class AreaCodeSelectRow : StatuRowLayout
{
///
/// 地区信息
///
public Common.ResponseEntity.AreaCodeOBJ codeObj = null;
///
/// 图标控件
///
private RowLeftIconView btnIcon = null;
///
/// 地区名
///
private RowCenterView btnArea = null;
///
/// 状态
///
private StatuMode Statu = StatuMode.UN_SELECT;
///
/// 是否处于选择状态
///
public bool IsSelect
{
get { return Statu == StatuMode.SELECT; }
set
{
if (value == false)
{
this.SetUnselectStatu();
}
else
{
this.SetSelectStatu();
}
}
}
///
/// 做成一个地区选择的行控件
///
/// 列表控件,可以为空
///
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();
}
}
///
/// 初始化内部控件
///
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);
}
///
/// 设定选择状态
///
public void SetSelectStatu()
{
if (Statu == StatuMode.SELECT)
{
return;
}
btnArea.TextColor = UserCenterColor.Current.SelectTextColor;
btnIcon.IsSelected = true;
//状态变更
Statu = StatuMode.SELECT;
}
///
/// 设置非选择状态
///
public void SetUnselectStatu()
{
if (Statu == StatuMode.UN_SELECT)
{
return;
}
btnArea.TextColor = UserCenterColor.Current.TextColor;
btnIcon.IsSelected = false;
//状态变更
Statu = StatuMode.UN_SELECT;
}
}
}