using System;
|
using Shared;
|
using HDL_ON.UI.CSS;
|
using HDL_ON.Entity;
|
|
namespace HDL_ON.UI
|
{
|
public partial class SetSceneLocationPage :FrameLayout
|
{
|
FrameLayout bodyView;
|
VerticalScrolViewLayout contentView;
|
Function scene;
|
Button lastButton;
|
Action backAction;
|
public SetSceneLocationPage(Function function, Action action)
|
{
|
backAction = action;
|
bodyView = this;
|
scene = function;
|
}
|
|
public void LoadPage()
|
{
|
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
|
|
new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView();
|
|
contentView = new VerticalScrolViewLayout()
|
{
|
Y = Application.GetRealHeight(64),
|
Height = Application.GetRealHeight(667 - 64),
|
};
|
bodyView.AddChidren(contentView);
|
|
System.Collections.Generic.List<Room> rooms = new System.Collections.Generic.List<Room>();
|
rooms.Add(new Room() { sid = "", name = Language.StringByID(StringId.WholeHouseScene),floorId = "" });
|
rooms.AddRange(DB_ResidenceData.rooms);
|
foreach (var room in rooms)
|
{
|
var roomView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(50),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Tag = "row"
|
};
|
contentView.AddChidren(roomView);
|
|
Button btnRoomText = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Width = Application.GetRealWidth(280),
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
Text = room.floorName + room.name,
|
};
|
roomView.AddChidren(btnRoomText);
|
|
Button btnChoose = new Button()
|
{
|
X = Application.GetRealWidth(331),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(28),
|
Height = Application.GetMinRealAverage(28),
|
UnSelectedImagePath = "Public/ChooseIcon.png",
|
SelectedImagePath = "Public/ChooseOnIcon.png",
|
Tag = "ChooseIcon"
|
};
|
roomView.AddChidren(btnChoose);
|
if(scene.roomIdList.Contains(room.sid))
|
{
|
btnChoose.IsSelected = true;
|
lastButton = btnChoose;
|
}
|
btnChoose.MouseUpEventHandler = (sender, e) => {
|
btnChoose.IsSelected = !btnChoose.IsSelected;
|
//LoadEvent_RoomSelected(room, btnChoose.IsSelected);
|
};
|
var btnLine = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(49),
|
Height = Application.GetRealHeight(1),
|
Width = Application.GetRealWidth(343),
|
BackgroundColor = CSS_Color.DividingLineColor,
|
};
|
roomView.AddChidren(btnLine);
|
|
LoadEvent_ChangeSceneLocation(room, btnChoose);
|
|
}
|
}
|
}
|
|
//===----------------
|
public partial class SetSceneLocationPage
|
{
|
void LoadEvent_ChangeSceneLocation(Room room,Button btn)
|
{
|
btn.MouseUpEventHandler = (sender, e) => {
|
if (lastButton != null)
|
{
|
lastButton.IsSelected = false;
|
}
|
lastButton = btn;
|
btn.IsSelected = true;
|
scene.roomIdList = new System.Collections.Generic.List<string>();
|
scene.roomIdList.Add(room.sid);
|
this.RemoveFromParent();
|
backAction();
|
};
|
}
|
}
|
}
|