using System;
|
using Shared.Common;
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class CategoryFunctionRow : 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>
|
/// ZoneBtn
|
/// </summary>
|
private Button StatuBtn;
|
/// <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 CategoryFunctionRow(int x = 0, int y = 0)
|
{
|
X = Application.GetRealWidth(x);
|
Y = Application.GetRealHeight(y);
|
Width = Application.GetRealWidth(1022);
|
Height = Application.GetRealHeight(127-2);
|
//BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
}
|
|
/// <summary>
|
/// Init
|
/// </summary>
|
/// <param name="imagePath"></param>
|
/// <param name="selectedImagePath"></param>
|
public void Init(string imagePath, string selectedImagePath)
|
{
|
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(181),
|
Y = Application.GetRealHeight(14),
|
Width = Application.GetRealWidth(600),
|
Height = Application.GetRealHeight(58),
|
TextColor = ZigbeeColor.Current.GXCTextBlackColor,
|
SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize=14,
|
Tag = Tag
|
};
|
AddChidren(NameBtn);
|
|
StatuBtn = new Button
|
{
|
X = Application.GetRealWidth(181),
|
Y = Application.GetRealHeight(72),
|
Width = Application.GetRealWidth(400),
|
Height = Application.GetRealHeight(49),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor2,
|
TextSize=10
|
};
|
AddChidren(StatuBtn);
|
|
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(181),
|
Y = Height - 1,
|
Width = Application.GetRealWidth(821),
|
Height = 1,
|
BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor,
|
Tag = Tag
|
};
|
AddChidren(line);
|
|
ClickBtn = new Button
|
{
|
Width=Application.GetRealWidth(890)
|
};
|
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>
|
/// SetZoneText
|
/// </summary>
|
/// <param name="title"></param>
|
public void SetStatuText(string title)
|
{
|
StatuBtn.Text = title;
|
}
|
/// <summary>
|
/// SetStatu
|
/// </summary>
|
/// <param name="statu"></param>
|
public void SetStatu(bool statu)
|
{
|
SwitchBtn.IsSelected = statu;
|
NameBtn.IsSelected = ImageBG.IsSelected = ImageBtn.IsSelected = statu;
|
NameBtn.IsBold = statu;
|
}
|
|
/// <summary>
|
/// SetStatu
|
/// </summary>
|
/// <param name="statu"></param>
|
public void SetOnLineStatu(bool statu)
|
{
|
NameBtn.IsSelected = ImageBG.IsSelected = ImageBtn.IsSelected = statu;
|
}
|
|
/// <summary>
|
/// HideSwitchBtn
|
/// </summary>
|
/// <param name="statu"></param>
|
public void HideSwitchBtn(bool statu)
|
{
|
SwitchBtn.Visible = !statu;
|
}
|
|
/// <summary>
|
/// SetDeviceIcon
|
/// </summary>
|
/// <param name="imagePath"></param>
|
/// <param name="selectedImagePath"></param>
|
public void SetDeviceIcon(string imagePath, string selectedImagePath)
|
{
|
ImageBtn.UnSelectedImagePath = imagePath;
|
ImageBtn.SelectedImagePath = selectedImagePath;
|
}
|
}
|
}
|