using System;
|
using HDL_ON.Entity;
|
using Shared;
|
|
namespace HDL_ON.UI
|
{
|
public partial class FloorsManagementPage
|
{
|
/// <summary>
|
/// 楼层按钮修改名称点击事件
|
/// </summary>
|
void LoadEvent_FloorNamgeChange(Button btn,Button btnDel,RowLayout row)
|
{
|
btn.MouseUpEventHandler = (sender, e) =>
|
{
|
Action<string> editCallBack = (newName) =>
|
{
|
//楼层名称不能为空
|
if (string.IsNullOrEmpty(newName))
|
{
|
new Tip()
|
{
|
CloseTime = 3,
|
Text = Language.StringByID(StringId.FloorNameCannotBeEmpty),
|
Direction = AMPopTipDirection.None,
|
}.Show(bodyView);
|
return;
|
}
|
if (DB_ResidenceData.residenceData.floors.Contains(newName))
|
{
|
return;
|
}
|
else
|
{
|
DB_ResidenceData.residenceData.floors[DB_ResidenceData.residenceData.floors.IndexOf(btn.Text)] = newName;
|
//DB_ResidenceData.residenceData.SaveResidenceData();
|
btn.Text = newName;
|
btnDel.Tag = newName;
|
row.Tag = newName;
|
}
|
};
|
new PublicAssmebly().LoadDialog_EditParater(StringId.EditFloorName, btn.Text, 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 = DB_ResidenceData.residenceData.floors[(int)(sender as Button).Tag];
|
refreshFloorList("del", btn.Tag.ToString());
|
};
|
new PublicAssmebly().TipMsg(StringId.Tip, StringId.DelFloorTip, action);
|
};
|
}
|
|
/// <summary>
|
/// 房间绑定楼层事件
|
/// </summary>
|
void LoadEvent_BindFloor()
|
{
|
btnConfrim.MouseUpEventHandler = (sender, e) =>
|
{
|
if (lastButton == null)
|
{
|
return;
|
}
|
room.floorIndex = DB_ResidenceData.residenceData.floors.IndexOf(lastButton.Text.Trim());
|
room.floorIndex = DB_ResidenceData.residenceData.floors.IndexOf(lastButton.Text.Trim());
|
backAction?.Invoke();
|
bodyView.RemoveFromParent();
|
DB_ResidenceData.residenceData.SaveResidenceData();
|
};
|
}
|
|
}
|
}
|