using System;
using HDL_ON.Entity;
using Shared;
namespace HDL_ON.UI
{
public partial class RoomsManagementPage
{
///
/// 进入编辑房间之后的回调
///
Action editBackAction;
///
/// 跳转到增加房间的界面
///
void LoadEvent_SkipAddRoomPage()
{
skipAddRoomAction = () =>
{
Action addRoomBackAction = (newRoom) =>
{
LoadRoomRow(newRoom);
};
var addRoomPage = new AddRoomPage(addRoomBackAction);
MainPage.BasePageView.AddChidren(addRoomPage);
addRoomPage.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
}
///
/// 跳转到编辑房间的界面
///
void LoadEvent_SkipEditRoomPage(Room r, Button btnRoomName, ImageView btnBg, FrameLayout roomRow)
{
editBackAction = () =>
{
if (string.IsNullOrEmpty(r.roomId))
{
for (int i = 0; i < roomsListView.ChildrenCount; )
{
if (roomsListView.GetChildren(i).Tag.ToString() == r.roomName + "line" || roomsListView.GetChildren(i).Tag.ToString() == r.roomName + "row")
{
roomsListView.GetChildren(i).RemoveFromParent();
}
else
{
i++;
}
}
}
else
{
btnRoomName.Text = r.floorName + r.roomName;
btnBg.ImagePath = r.backgroundImage;
}
};
Action deleteAction = () => {
roomRow.RemoveFromParent();
};
Action modifyImageAction = () => {
ImageUtlis.Current.LoadLocalOrNetworkImages(r.backgroundImage, btnBg);
};
var skipPage = new RoomEditPage(r, editBackAction, deleteAction, modifyImageAction);
MainPage.BasePageView.AddChidren(skipPage);
skipPage.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
}
}
}