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