using System;
|
using HDL_ON.Entity;
|
using Shared;
|
|
namespace HDL_ON.UI
|
{
|
public partial class FloorsManagementPage
|
{
|
/// <summary>
|
/// 楼层按钮修改名称点击事件
|
/// </summary>
|
void LoadEvent_FloorNamgeChange(string floor,Button btn)
|
{
|
btn.MouseUpEventHandler = (sender, e) =>
|
{
|
Action<string> editCallBack = (newName) =>
|
{
|
if (DB_ResidenceData.residenceData.floors.Contains(newName))
|
{
|
return;
|
}
|
else
|
{
|
DB_ResidenceData.residenceData.floors.Add(newName);
|
DB_ResidenceData.residenceData.SaveResidenceData();
|
btn.Text = newName;
|
}
|
};
|
new PublicAssmebly().LoadDialog_EditParater(StringId.EditFloorName, floor, editCallBack);
|
};
|
}
|
|
|
Button lastButton;
|
/// <summary>
|
/// 房间绑定楼层,楼层选中事件
|
/// </summary>
|
void LoadEvent_FloorChoose(Button btn)
|
{
|
btn.MouseUpEventHandler = (sender, e) => {
|
if (lastButton != null)
|
{
|
lastButton.IsSelected = false;
|
if (lastButton.Text == btn.Text)
|
{
|
lastButton = null;
|
}
|
//btn.IsBold = false;
|
}
|
btn.IsSelected = true;
|
//btn.IsBold = true;
|
lastButton = btn;
|
};
|
}
|
|
/// <summary>
|
/// 删除楼层
|
/// </summary>
|
void LoadEvent_DelFloor(Button btn)
|
{
|
btn.MouseUpEventHandler += (sender, e) =>
|
{
|
Action action = () =>
|
{
|
string delFloor = (sender as Button).Tag.ToString();
|
DB_ResidenceData.residenceData.floors.Remove(delFloor);
|
DB_ResidenceData.residenceData.SaveResidenceData();
|
topCallBack("del", delFloor);
|
};
|
new PublicAssmebly().TipMsg(StringId.Tip, StringId.DelFloorTip, action);
|
};
|
}
|
|
/// <summary>
|
/// 房间绑定楼层事件
|
/// </summary>
|
void LoadEvent_BindFloor()
|
{
|
btnConfrim.MouseUpEventHandler = (sender, e) =>
|
{
|
if (lastButton != null)
|
{
|
room.floorIndex = DB_ResidenceData.residenceData.floors.IndexOf(lastButton.Text.Trim());
|
}
|
room.floorIndex = DB_ResidenceData.residenceData.floors.IndexOf(lastButton.Text.Trim());
|
if (backAction != null)
|
{
|
backAction();
|
}
|
bodyView.RemoveFromParent();
|
DB_ResidenceData.residenceData.SaveResidenceData();
|
};
|
}
|
|
}
|
}
|