using System;
|
using Shared.Common;
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class FunctionRow : FrameLayout
|
{
|
/// <summary>
|
/// name
|
/// </summary>
|
public Button NameBtn;
|
/// <summary>
|
/// Image
|
/// </summary>
|
public Button ImageBtn;
|
/// <summary>
|
/// ImageBG
|
/// </summary>
|
public Button ImageBG;
|
/// <summary>
|
/// SwitchBtn
|
/// </summary>
|
public Button SwitchBtn;
|
/// <summary>
|
/// ClickBtn
|
/// </summary>
|
public Button ClickBtn;
|
/// <summary>
|
/// v_Selected
|
/// </summary>
|
private bool v_Selected;
|
/// <summary>
|
/// IsSelected
|
/// </summary>
|
public bool IsSelected
|
{
|
set
|
{
|
v_Selected = value;
|
try
|
{
|
SetStatu(v_Selected);
|
}
|
catch
|
{
|
|
}
|
}
|
get
|
{
|
return v_Selected;
|
}
|
}
|
|
/// <summary>
|
/// FunctionRow
|
/// </summary>
|
/// <param name="x"></param>
|
/// <param name="y"></param>
|
public FunctionRow(int x = 0, int y = 0)
|
{
|
X = Application.GetRealWidth(x);
|
Y = Application.GetRealHeight(y);
|
Width = Application.GetRealWidth(1080);
|
Height = Application.GetRealHeight(127);
|
}
|
|
/// <summary>
|
/// Init
|
/// </summary>
|
/// <param name="imagePath"></param>
|
/// <param name="selectedImagePath"></param>
|
public void Init(string imagePath, string selectedImagePath,bool click=false)
|
{
|
ImageBG = new Button()
|
{
|
X = Application.GetRealWidth(45),
|
Width = Application.GetMinRealAverage(112),
|
Height = Application.GetMinRealAverage(112),
|
Gravity = Gravity.CenterVertical,
|
Radius=(uint)Application.GetMinRealAverage(112/2),
|
BackgroundColor=ZigbeeColor.Current.GXCGrayBackgroundColor,
|
SelectedBackgroundColor=ZigbeeColor.Current.GXCSelectedBackgroundColor,
|
Tag = Tag
|
};
|
AddChidren(ImageBG);
|
|
ImageBtn = new Button()
|
{
|
X = Application.GetRealWidth(63),
|
Width = Application.GetMinRealAverage(78),
|
Height = Application.GetMinRealAverage(78),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = imagePath,
|
SelectedImagePath = selectedImagePath,
|
Tag = Tag
|
};
|
AddChidren(ImageBtn);
|
|
NameBtn = new Button()
|
{
|
X = Application.GetRealWidth(200),
|
Width = Application.GetRealWidth(600),
|
Height = Application.GetRealHeight(80),
|
Gravity = Gravity.CenterVertical,
|
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
|
SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
Tag = Tag,
|
TextSize = 14
|
};
|
AddChidren(NameBtn);
|
|
SwitchBtn = new Button()
|
{
|
X = Application.GetRealWidth(896),
|
Width = Application.GetMinRealAverage(78),
|
Height = Application.GetMinRealAverage(78),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "Item/Switch.png",
|
SelectedImagePath = "Item/SwitchSelected.png",
|
Tag = Tag
|
};
|
AddChidren(SwitchBtn);
|
|
var line = new Button()
|
{
|
X = Application.GetRealWidth(200),
|
Y = Height - 1,
|
Width = Application.GetRealWidth(821),
|
Height = 1,
|
BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2,
|
Tag = Tag
|
};
|
AddChidren(line);
|
|
ClickBtn = new Button();
|
if (click)
|
{
|
AddChidren(ClickBtn);
|
}
|
}
|
|
/// <summary>
|
/// SetTitle
|
/// </summary>
|
/// <param name="title"></param>
|
public void SetTitle(string title)
|
{
|
NameBtn.Text = title;
|
}
|
/// <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 = ImageBG.IsSelected = ImageBtn.IsSelected = SwitchBtn.IsSelected = statu;
|
}
|
|
/// <summary>
|
/// HideSwitchBtn
|
/// </summary>
|
/// <param name="statu"></param>
|
public void HideSwitchBtn(bool statu)
|
{
|
SwitchBtn.Visible = statu;
|
}
|
}
|
}
|