using System;
using Shared;
using HDL_ON.UI.CSS;
using HDL_ON.Entity;
namespace HDL_ON.UI
{
public partial class SocketPage : FrameLayout
{
#region 控件集合
static SocketPage bodyView;
///
/// 功能名称按钮
///
Button btnFunctionName;
///
/// 房间楼层信息按钮
///
Button btnFromFoorAndRoom;
///
/// 收藏按钮
///
Button btnCollection;
///
/// 图标按钮
///
Button btnSwitchIcon;
Button btnSwitch;
#endregion
#region 区域变量
SwitchSocket socketFunction;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
///
/// 刷新显示信息
///
Action actionRefresh;
#endregion
public SocketPage(Function func)
{
bodyView = this;
socketFunction = func as SwitchSocket;
}
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
{
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
btnCollection_Out = btnCollectionIcon;
btnFunctionName_Out = btnFunctionNameOut;
btnFromFloor_Out = btnFromFloorOut;
FrameLayout controlView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(88),
Width = Application.GetRealWidth(327),
Height = Application.GetRealHeight(526),
BackgroundImagePath = "Public/Fragmentbg.png",
};
bodyView.AddChidren(controlView);
btnFunctionName = new Button()
{
X = Application.GetRealWidth(16),
Y = Application.GetRealHeight(14),
Width = Application.GetRealWidth(270),
Height = Application.GetRealHeight(37),
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
Text = socketFunction.name,
};
controlView.AddChidren(btnFunctionName);
btnFromFoorAndRoom = new Button()
{
X = Application.GetRealWidth(16),
Y = btnFunctionName.Bottom,
Width = Application.GetRealWidth(270),
Height = Application.GetRealHeight(21),
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
Text = socketFunction.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
btnCollection = new Button()
{
X = Application.GetRealWidth(273),
Y = Application.GetRealHeight(14),
Width = Application.GetMinRealAverage(40),
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
IsSelected = socketFunction.collection
};
controlView.AddChidren(btnCollection);
btnSwitchIcon = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(100),
Width = Application.GetRealWidth(198),
Height = Application.GetRealWidth(198),
IsSelected = socketFunction.on_off == "on",
UnSelectedImagePath = "FunctionIcon/Socket/SocketIconBg.png",
SelectedImagePath = "FunctionIcon/Socket/SocketIconOnBg.png",
};
controlView.AddChidren(btnSwitchIcon);
btnSwitch = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(462),
Width = Application.GetMinRealAverage(40),
Height = Application.GetMinRealAverage(40),
UnSelectedImagePath = "Public/PowerClose.png",
SelectedImagePath = "Public/PowerOpen.png",
IsSelected = socketFunction.on_off == "on"
};
controlView.AddChidren(btnSwitch);
LoadEventList();
new TopViewDiv(bodyView, Language.StringByID(StringId.Fan)).LoadTopView(socketFunction, actionRefresh);
}
}
}