using System;
using Shared.Common;
namespace Shared.Phone.Device.CommonForm
{
public class LeftIconButtonRow:FrameLayout
{
#region ◆ 变量__________________________
///
/// 图片
///
public Button IconButton;
///
/// 标题
///
public Button TitleButton;
///
/// 下划线
///
public FrameLayout Line;
///
/// v_Selected
///
private bool v_Selected;
public bool IsSelected
{
set
{
v_Selected = value;
try
{
SetStatu(v_Selected);
}
catch { };
}
get
{
return v_Selected;
}
}
#endregion
public LeftIconButtonRow(int width,int height, int x = 0, int y = 0)
{
X = x;
Y = y;
Width = Application.GetRealWidth(width);
Height = Application.GetRealHeight(height);
}
#region ◆ 初始化__________________________
///
/// Init
///
/// Icon path.
/// Icon selected path.
/// Title.
public void Init(string iconPath, string iconSelectedPath, string title, bool hadLine = true)
{
IconButton = new Button()
{
X = Application.GetRealWidth(80),
Height = Application.GetMinRealAverage(80),
Width = Application.GetMinRealAverage(80),
UnSelectedImagePath = iconPath,
SelectedImagePath = iconSelectedPath,
Gravity = Gravity.CenterVertical,
Tag = this.Tag
};
AddChidren(IconButton);
TitleButton = new Button()
{
X = Application.GetRealWidth(173),
Height = Application.GetRealHeight(80),
Width = Application.GetRealWidth(220),
TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor,
Text = title,
TextAlignment = TextAlignment.CenterLeft,
Gravity = Gravity.CenterVertical,
Tag = this.Tag
};
AddChidren(TitleButton);
Line = new FrameLayout()
{
X = Application.GetRealWidth(80),
Y = this.Height - 1,
Width = Application.GetRealWidth(369),
Height = 1,
BackgroundColor = Common.ZigbeeColor.Current.GXCGrayLineColor2
};
if (hadLine)
{
AddChidren(Line);
}
}
#endregion
#region ◆ 选中状态__________________________
///
/// 设置状态
///
///
public void SetStatu(bool statu)
{
IconButton.IsSelected = statu;
TitleButton.IsSelected = statu;
}
///
/// 选中
///
public void SetSelectedStatu()
{
IconButton.IsSelected = true;
TitleButton.IsSelected = true;
}
///
/// 不选中
///
public void SetUnSelectedStatu()
{
IconButton.IsSelected = false;
TitleButton.IsSelected = false;
}
#endregion
}
}