using System;
using System.Collections.Generic;
using HDL_ON.Entity;
namespace HDL_ON.UI
{
public partial class TopViewDiv
{
void LoadEventList()
{
LoadEvent_BackEvent();
}
void LoadEvent_BackEvent()
{
btnBack.MouseUpEventHandler = (sender, e) => {
backAction?.Invoke();
if (baseView != null)
{
baseView.RemoveFromParent();
}
if (baseDialog != null)
{
baseDialog.Close();
}
};
}
///
/// 顶部添加按钮点击事件
///
/// 添加按钮的功能类型
void LoadEvent_AddEvent(string type,Action callBack)
{
switch (type)
{
case "floors":
Action callBackAction = (floorName) =>
{
callBack("add", floorName);
};
string newFloorName = "1F";
for (int i = 0; i < DB_ResidenceData.residenceData.floors.Count + 1; )
{
newFloorName = ++i + "F";
if (null == DB_ResidenceData.residenceData.floors.Find((obj)=>obj.name == newFloorName))
{
break;
}
}
var fs = new List();
foreach(var f in DB_ResidenceData.residenceData.floors)
{
fs.Add(f.name);
}
new PublicAssmebly().LoadDialog_EditParater(StringId.AddFloors,newFloorName , callBackAction,StringId.FloorNameCannotBeEmpty,
StringId.AddFloorFailed_FloorAlreadyExist,fs);
break;
case "rooms":
callBack("", "");
break;
case "Member":
callBack("","");
break;
}
}
}
}