using System; using System.Collections.Generic; using System.Text; namespace Shared.Phone.UserCenter { /// /// 做成一个地区选择的行控件 /// public class AreaCodeSelectRow : RowLayoutControl { /// /// 地区信息 /// public Common.ResponseEntity.AreaCodeOBJ codeObj = null; /// /// 图标控件 /// private IconViewControl btnIcon = null; /// /// 地区名 /// private NormalViewControl 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.frameTable.ButtonClickEvent += (sender, e) => { this.IsSelect = Statu == StatuMode.SELECT ? false : true; }; if (listView != null) { listView.AddChidren(this); //初始化内部控件 this.InitControl(); } } /// /// 初始化内部控件 /// public void InitControl() { //图标 btnIcon = this.frameTable.AddLeftIcon(); btnIcon.UnSelectedImagePath = "Account/Check.png"; btnIcon.SelectedImagePath = "Account/CheckSelected.png"; //地区 btnArea = this.frameTable.AddLeftCaption(this.codeObj.Name, 400); btnArea.Text = this.codeObj.Name; } /// /// 设定选择状态 /// 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.TextColor1; btnIcon.IsSelected = false; //状态变更 Statu = StatuMode.UN_SELECT; } } }