using System;
|
using Shared.Common;
|
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class FunctionIconButton : FrameLayout
|
{
|
|
/// <summary>
|
/// Image
|
/// </summary>
|
public Button ImageBtn;
|
/// <summary>
|
/// ImageBG
|
/// </summary>
|
public Button ImageBG;
|
/// <summary>
|
/// v_Selected
|
/// </summary>
|
private bool v_Selected;
|
/// <summary>
|
/// IsSelected
|
/// </summary>
|
public bool IsSelected
|
{
|
set
|
{
|
try
|
{
|
v_Selected = value;
|
SetStatu(v_Selected);
|
}
|
catch { };
|
}
|
get
|
{
|
return v_Selected;
|
}
|
}
|
|
/// <summary>
|
/// FunctionIconButton
|
/// </summary>
|
/// <param name="x"></param>
|
/// <param name="y"></param>
|
public FunctionIconButton(int x = 0, int y = 0)
|
{
|
X = Application.GetRealWidth(x);
|
Y = Application.GetRealHeight(y);
|
Width = Application.GetRealWidth(207);
|
Height = Application.GetRealHeight(207);
|
}
|
|
/// <summary>
|
/// Init
|
/// </summary>
|
/// <param name="imagePath"></param>
|
/// <param name="selectedImagePath"></param>
|
public void Init(string imagePath, string selectedImagePath)
|
{
|
ImageBG = new Button()
|
{
|
Width = Application.GetRealWidth(207),
|
Height = Application.GetRealWidth(207),
|
Gravity = Gravity.Center,
|
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
|
SelectedBackgroundColor = ZigbeeColor.Current.GXCSelectedBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(207 / 2)
|
};
|
AddChidren(ImageBG);
|
|
ImageBtn = new Button()
|
{
|
Width = Application.GetMinRealAverage(114),
|
Height = Application.GetMinRealAverage(114),
|
Gravity = Gravity.Center,
|
UnSelectedImagePath = imagePath,
|
SelectedImagePath = selectedImagePath,
|
};
|
AddChidren(ImageBtn);
|
}
|
|
/// <summary>
|
/// SetStatu
|
/// </summary>
|
/// <param name="statu"></param>
|
public void SetStatu(bool statu)
|
{
|
ImageBG.IsSelected = ImageBtn.IsSelected = statu;
|
}
|
}
|
}
|