using System;
|
using System.Collections.Generic;
|
using HDL_ON.Entity;
|
using HDL_ON.UI;
|
using HDL_ON.UI.CSS;
|
using Shared;
|
|
namespace HDL_ON.UI
|
{
|
public partial class ClassificationPage : FrameLayout
|
{
|
|
#region 控件列表
|
FrameLayout bodyView;
|
#region 顶部控件
|
/// <summary>
|
/// 房间分页
|
/// </summary>
|
Button btnRoomTilte;
|
/// <summary>
|
/// 功能分类
|
/// </summary>
|
Button btnFuncTitle;
|
#endregion
|
|
#region 房间区域
|
/// <summary>
|
/// 房间内容显示区域
|
/// </summary>
|
FrameLayout roomContentView;
|
#region 房间底部切换显示区域
|
/// <summary>
|
/// 房间区域,顶部区域
|
/// </summary>
|
FrameLayout roomTopView;
|
/// <summary>
|
/// 楼层选择下拉图标
|
/// </summary>
|
Button btnFoorDownIcon;
|
/// <summary>
|
/// 楼层显示
|
/// </summary>
|
Button btnFoor;
|
/// <summary>
|
/// 显示方式切换按钮
|
/// </summary>
|
Button btnSwitchDipaly;
|
#endregion
|
/// <summary>
|
/// 房间列表区域
|
/// </summary>
|
VerticalScrolViewLayout roomListView;
|
/// <summary>
|
/// 房间区域集合
|
/// </summary>
|
List<FrameLayout> roomViewList;
|
#endregion
|
|
|
#endregion
|
|
public ClassificationPage()
|
{
|
bodyView = this;
|
}
|
|
public void LoadPage()
|
{
|
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
|
#region top
|
FrameLayout topView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(64),
|
BackgroundColor = CSS_Color.TopViewColor,
|
};
|
bodyView.AddChidren(topView);
|
|
btnRoomTilte = new Button()
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(170),
|
Height = Application.GetRealHeight(25),
|
TextAlignment = TextAlignment.CenterRight,
|
TextSize = CSS_FontSize.HeadlineFontSize,
|
TextColor = CSS_Color.PromptingColor1,
|
SelectedTextColor = CSS_Color.MainColor,
|
TextID = StringId.Rooms,
|
IsSelected = true
|
};
|
topView.AddChidren(btnRoomTilte);
|
|
btnFuncTitle = new Button()
|
{
|
X = Application.GetRealWidth(209),
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(170),
|
Height = Application.GetRealHeight(25),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextColor = CSS_Color.PromptingColor1,
|
SelectedTextColor = CSS_Color.MainColor,
|
TextID = StringId.Devices,
|
};
|
topView.AddChidren(btnFuncTitle);
|
|
#endregion
|
|
|
|
#region 房间区域
|
/// <summary>
|
/// 房间内容显示区域
|
/// </summary>
|
roomContentView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(64),
|
Height = Application.GetRealHeight(52),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
};
|
bodyView.AddChidren(roomContentView);
|
#region 房间底部切换显示区域
|
/// <summary>
|
/// 房间区域,顶部区域
|
/// </summary>
|
roomTopView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(53),
|
};
|
roomContentView.AddChidren(roomTopView);
|
/// <summary>
|
/// 楼层选择下拉图标
|
/// </summary>
|
btnFoorDownIcon = new Button()
|
{
|
Width = Application.GetMinRealAverage(16),
|
Height = Application.GetMinRealAverage(16),
|
X = Application.GetRealWidth(16),
|
Y = Application.GetRealHeight(18),
|
UnSelectedImagePath = "Public/DownIcon.png",
|
};
|
roomContentView.AddChidren(btnFoorDownIcon);
|
/// <summary>
|
/// 楼层显示
|
/// </summary>
|
btnFoor = new Button()
|
{
|
X = btnFoorDownIcon.Right,
|
Y = Application.GetRealHeight(18),
|
Width = Application.GetRealWidth(200),
|
Height = Application.GetMinRealAverage(16),
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
TextAlignment = TextAlignment.CenterLeft,
|
Text = UserConfig.Instance.CurFoor,
|
};
|
roomContentView.AddChidren(btnFoor);
|
/// <summary>
|
/// 显示方式切换按钮
|
/// </summary>
|
btnSwitchDipaly = new Button()
|
{
|
X = Application.GetRealWidth(335),
|
Y = Application.GetRealHeight(12),
|
Width = Application.GetMinRealAverage(28),
|
Height = Application.GetMinRealAverage(28),
|
UnSelectedImagePath = "Classification/ToggleDisplayThumbnail.png",//缩略图
|
SelectedImagePath = "Classification/ToggleDisplayLarge.png",
|
};
|
roomContentView.AddChidren(btnSwitchDipaly);
|
#endregion
|
|
|
/// <summary>
|
/// 房间列表区域
|
/// </summary>
|
roomListView = new VerticalScrolViewLayout()
|
{
|
Y = roomContentView.Bottom,
|
Height = Application.GetRealHeight(497 + 10+30),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
};
|
bodyView.AddChidren(roomListView);
|
/// <summary>
|
/// 房间区域集合
|
/// </summary>
|
roomViewList = new List<FrameLayout>();
|
|
|
#if DEBUG1
|
var r = new Room() { sid = "0001", name = "Room-1", floor = "1F", backgroundImage = "Classification/Room/Roombg.png" };
|
r.functions.Add(new Function()
|
{
|
sid = "000000000000000000000000000000000001",
|
funcType = FunctionType.AC,
|
name = "空调",
|
roomIdList = new List<string>() { "0001" },
|
lastState = "制冷 中风 18°C",
|
bus_Data = "{" +
|
"\"SubnetID\":42" + "," +
|
"\"DeviceID\":8" + "," +
|
"\"LoopID\":1" +
|
"}",
|
});
|
r.functions.Add(new Dimmer()
|
{
|
sid = "0001002019101209000025670400010002",
|
funcType = FunctionType.Light,
|
name = "客厅灯",
|
roomIdList = new List<string>() { "0001" },
|
lastState = "20%",
|
bus_Data = "{" +
|
"\"SubnetID\":111" + "," +
|
"\"DeviceID\":2" + "," +
|
"\"LoopID\":1" +
|
"}",
|
});
|
r.functions.Add(new MotorCurtain()
|
{
|
sid = "000000000000000000000000000000000003",
|
funcType = FunctionType.Curtain,
|
name = "窗帘",
|
roomIdList = new List<string>() { "0001" },
|
lastState = "20%",
|
bus_Data = "{" +
|
"\"SubnetID\":42" + "," +
|
"\"DeviceID\":7" + "," +
|
"\"LoopID\":1" +
|
"}",
|
});
|
r.functions.Add(new Function()
|
{
|
sid = "000000000000000000000000000000000004",
|
funcType = FunctionType.FloorHeating,
|
name = "地热",
|
roomIdList = new List<string>() { "0001" },
|
lastState = ""
|
});
|
r.functions.Add(new Light()
|
{
|
sid = "0001002019101209000025670400010005",
|
funcType = FunctionType.Light,
|
name = "客厅大灯",
|
roomIdList = new List<string>() { "0001" },
|
bus_Data = "{" +
|
"\"SubnetID\":111" + "," +
|
"\"DeviceID\":6" + "," +
|
"\"LoopID\":1" +
|
"}",
|
});
|
r.functions.Add(new RGBLight()
|
{
|
sid = "0001002019101209000025670500010006",
|
funcType = FunctionType.Light,
|
name = "客厅RGB灯",
|
roomIdList = new List<string>() { "0001" },
|
bus_Data = "{" +
|
"\"SubnetID\":222" + "," +
|
"\"DeviceID\":222" + "," +
|
"\"LoopID\":222" +
|
"}",
|
});
|
|
DB_ResidenceData.residenceData.rooms.Add(r);
|
|
#endif
|
|
|
foreach (var room in DB_ResidenceData.residenceData.rooms)
|
{
|
var roomView = new FrameLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(184),
|
Radius = (uint)Application.GetRealHeight(12),
|
BorderColor = 0x00000000,
|
BorderWidth = 1,
|
};
|
roomListView.AddChidren(roomView);
|
|
var roomViewbg = new Button()
|
{
|
UnSelectedImagePath = room.backgroundImage,
|
};
|
roomView.AddChidren(roomViewbg);
|
|
var roomViewbgColor = new Button()
|
{
|
BackgroundColor = 0x19333333,
|
};
|
roomView.AddChidren(roomViewbgColor);
|
|
var btnFloorAndRoomName = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Y = Application.GetRealHeight(12 - 2),
|
Width = Application.GetRealWidth(266),
|
Height = Application.GetRealHeight(22 + 2 + 2),
|
Text = room.floor + " " + room.name,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.MainBackgroundColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
};
|
roomView.AddChidren(btnFloorAndRoomName);
|
|
|
#region 环境数据
|
var environmentalView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(2) + btnFloorAndRoomName.Bottom,
|
Height = Application.GetRealHeight(32),
|
Tag = "EnvironmentalView",
|
};
|
topView.AddChidren(environmentalView);
|
|
Button btnTempIcon = new Button()
|
{
|
X = Application.GetRealWidth(12),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(16),
|
Height = Application.GetMinRealAverage(16),
|
UnSelectedImagePath = "Public/InfoIcon/TempIcon.png",
|
};
|
environmentalView.AddChidren(btnTempIcon);
|
|
var btnTempValues = new Button()
|
{
|
X = btnTempIcon.Right + Application.GetRealWidth(4),
|
Width = Application.GetRealWidth(30),
|
Gravity = Gravity.CenterVertical,
|
TextColor = CSS.CSS_Color.MainBackgroundColor,
|
TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
|
Text = "--°",
|
TextAlignment = TextAlignment.CenterLeft,
|
Tag = "TempValues"
|
};
|
environmentalView.AddChidren(btnTempValues);
|
|
Button btnHumidityIcon = new Button()
|
{
|
X = btnTempValues.Right + Application.GetRealWidth(2),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(16),
|
Height = Application.GetMinRealAverage(16),
|
UnSelectedImagePath = "Public/InfoIcon/HumidityIcon.png",
|
};
|
environmentalView.AddChidren(btnHumidityIcon);
|
|
var btnHumidityValues = new Button()
|
{
|
X = btnHumidityIcon.Right + Application.GetRealWidth(4),
|
Width = Application.GetRealWidth(30),
|
Gravity = Gravity.CenterVertical,
|
TextColor = CSS.CSS_Color.MainBackgroundColor,
|
TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
|
Text = "--%",
|
TextAlignment = TextAlignment.CenterLeft,
|
Tag = "HumidityValues"
|
};
|
environmentalView.AddChidren(btnHumidityValues);
|
|
Button btnPm25Icon = new Button()
|
{
|
X = btnHumidityValues.Right + Application.GetRealWidth(2),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(16),
|
Height = Application.GetMinRealAverage(16),
|
UnSelectedImagePath = "Public/InfoIcon/Pm25Icon.png",
|
};
|
environmentalView.AddChidren(btnPm25Icon);
|
|
var btnPm25Values = new Button()
|
{
|
X = btnPm25Icon.Right + Application.GetRealWidth(4),
|
Width = Application.GetRealWidth(30),
|
Gravity = Gravity.CenterVertical,
|
TextColor = CSS.CSS_Color.MainBackgroundColor,
|
TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
|
Text = "--",
|
TextAlignment = TextAlignment.CenterLeft,
|
Tag = "Pm25Values"
|
};
|
environmentalView.AddChidren(btnPm25Values);
|
roomView.AddChidren(environmentalView);
|
#endregion
|
|
var btnAllClose = new Button()
|
{
|
X = Application.GetRealWidth(282),
|
Y = Application.GetRealHeight(126),
|
Width = Application.GetMinRealAverage(58),
|
Height = Application.GetMinRealAverage(58),
|
UnSelectedImagePath = "",
|
SelectedImagePath = "Classification/Room/AllCloseIcon.png",
|
};
|
roomView.AddChidren(btnAllClose);
|
#if DEBUG
|
btnAllClose.IsSelected = true;
|
#endif
|
|
var btn = new Button()
|
{
|
Height = Application.GetRealHeight(20),
|
};
|
roomListView.AddChidren(btn);
|
|
|
roomViewList.Add(roomView);
|
|
roomViewbgColor.MouseUpEventHandler += (sender, e) => {
|
var view = new RoomPage(room);
|
MainPage.BasePageView.AddChidren(view);
|
view.LoadPage();
|
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
};
|
|
}
|
|
roomListView.AddChidren(new Button() { Height = Application.GetRealHeight(20) });//太高视图,将导航了遮挡的部分完整显示
|
#endregion
|
|
}
|
}
|
}
|