using System;
|
using Shared;
|
|
namespace HDL_ON.UI
|
{
|
public partial class ChooseRoomPage
|
{
|
/// <summary>
|
/// 加载事件列表
|
/// </summary>
|
void LoadEventLoad()
|
{
|
LoadMethod_AllElection();
|
}
|
|
/// <summary>
|
/// 全选按钮事件
|
/// </summary>
|
void LoadMethod_AllElection()
|
{
|
btnChooseAll.MouseUpEventHandler += (sender, e) =>
|
{
|
btnChooseAll.IsSelected = !btnChooseAll.IsSelected;
|
|
for (int i = 0; i < contentView.ChildrenCount; i++)
|
{
|
var view = contentView.GetChildren(i);
|
if (view.GetType() == typeof(FrameLayout))
|
{
|
if (view.Tag != null && view.Tag.ToString() == "row")
|
{
|
for (int j = 0; j < (view as FrameLayout).ChildrenCount; j++)
|
{
|
var btn = (view as FrameLayout).GetChildren(j);
|
if (btn.GetType() == typeof(Button))
|
{
|
if (btn.Tag != null && btn.Tag.ToString() == "ChooseIcon")
|
{
|
(btn as Button).IsSelected = btnChooseAll.IsSelected;
|
}
|
}
|
}
|
}
|
}
|
}
|
function.roomIdList.Clear();
|
foreach (var room in Entity.DB_ResidenceData.residenceData.rooms)
|
{
|
if (btnChooseAll.IsSelected)
|
{
|
function.roomIdList.Add(room.sid);
|
}
|
else
|
{
|
function.roomIdList.Remove(room.sid);
|
}
|
}
|
Entity.DB_ResidenceData.residenceData.SaveResidenceData();
|
};
|
}
|
|
/// <summary>
|
/// 房间选中事件
|
/// </summary>
|
void LoadEvent_RoomSelected(Entity.Room room,bool isAdd)
|
{
|
if (isAdd)
|
{
|
function.roomIdList.Add(room.sid);
|
room.functionData.Add(function);
|
}
|
else
|
{
|
function.roomIdList.Remove(room.sid);
|
room.functionData.Remove(function);
|
}
|
Entity.DB_ResidenceData.residenceData.SaveResidenceData();
|
if (function.roomIdList.Count == Entity.DB_ResidenceData.residenceData.rooms.Count)
|
{
|
btnChooseAll.IsSelected = true;
|
}
|
else
|
{
|
btnChooseAll.IsSelected = false;
|
}
|
}
|
|
}
|
}
|