using System;
|
using Shared.Common;
|
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class ButtonLineForm : FrameLayout
|
{
|
/// <summary>
|
/// name
|
/// </summary>
|
public Button NameBtn;
|
/// <summary>
|
/// line
|
/// </summary>
|
public Button Line;
|
/// <summary>
|
/// isSelected
|
/// </summary>
|
private bool v_Selected;
|
/// <summary>
|
/// IsSelected
|
/// </summary>
|
public bool IsSelected
|
{
|
set
|
{
|
try
|
{
|
v_Selected = value;
|
SetStatu(v_Selected);
|
}
|
catch
|
{
|
v_Selected = false;
|
SetStatu(v_Selected);
|
}
|
}
|
get
|
{
|
return v_Selected;
|
}
|
}
|
|
/// <summary>
|
/// ButtonLineForm
|
/// </summary>
|
/// <param name="x"></param>
|
/// <param name="y"></param>
|
public ButtonLineForm(int x, int y)
|
{
|
X = Application.GetRealWidth(x);
|
Y = Application.GetRealHeight(y);
|
Width = Application.GetRealWidth(100);
|
Height = Application.GetRealHeight(85);
|
}
|
|
/// <summary>
|
/// Init
|
/// </summary>
|
public void Init()
|
{
|
NameBtn = new Button()
|
{
|
Width = Width,
|
Height = Height - Application.GetRealHeight(6),
|
TextColor = ZigbeeColor.Current.GXCTextGrayColor4,
|
SelectedTextColor = ZigbeeColor.Current.GXCTextDeepBlackColor,
|
TextSize = CommonFormResouce.TextSize,
|
TextAlignment = TextAlignment.CenterLeft
|
};
|
AddChidren(NameBtn);
|
|
Line = new Button
|
{
|
X = 0,
|
Y = Height - Application.GetRealHeight(6),
|
Width = 10,
|
Height = Application.GetRealHeight(6),
|
Radius = (uint)Application.GetRealHeight(6 / 2),
|
BackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor,
|
Visible = false
|
};
|
AddChidren(Line);
|
}
|
|
/// <summary>
|
/// SetTitle
|
/// </summary>
|
/// <param name="title"></param>
|
public void SetTitle(string title)
|
{
|
NameBtn.Text = title;
|
RefreshWidth();
|
}
|
|
/// <summary>
|
/// RefreshWidth
|
/// </summary>
|
public void RefreshWidth()
|
{
|
NameBtn.Width = NameBtn.GetTextWidth() + Application.GetRealWidth(100);
|
Width = NameBtn.Width;
|
Line.X = NameBtn.GetTextWidth() / 4;
|
Line.Width= NameBtn.GetTextWidth() / 2;
|
}
|
|
/// <summary>
|
/// SetTitle
|
/// </summary>
|
/// <param name="title"></param>
|
public void SetTitle(int title)
|
{
|
SetTitle(Language.StringByID(title));
|
}
|
|
/// <summary>
|
/// SetStatu
|
/// </summary>
|
/// <param name="statu"></param>
|
public void SetStatu(bool statu)
|
{
|
NameBtn.IsSelected = Line.Visible = statu;
|
NameBtn.TextSize = statu ? CommonFormResouce.TextSize_Selected : CommonFormResouce.TextSize;
|
NameBtn.IsBold = statu;
|
RefreshWidth();
|
}
|
}
|
}
|