using System;
|
using HDL_ON.Entity;
|
|
namespace HDL_ON.UI
|
{
|
public partial class DimmerPage
|
{
|
void LoadEventList()
|
{
|
|
LoadSwitchEvent();
|
LoadCollectionEvent();
|
//回退刷新信息事件
|
actionRefresh = () => {
|
btnFunctionName.Text = btnFunctionName_Out.Text = light.name;
|
btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName();
|
};
|
}
|
|
|
/// <summary>
|
/// 收藏功能按钮事件
|
/// </summary>
|
void LoadCollectionEvent()
|
{
|
btnCollection.MouseUpEventHandler += (sender, e) => {
|
btnCollection.IsSelected = light.collection = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
|
DB_ResidenceData.residenceData.SaveResidenceData();
|
};
|
}
|
|
/// <summary>
|
/// 加载开关事件
|
/// </summary>
|
void LoadSwitchEvent()
|
{
|
btnSwitch.MouseUpEventHandler += (sender, e) =>
|
{
|
btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
|
new System.Threading.Thread(() =>
|
{
|
var light = this.light as Light;
|
light.state = btnSwitch.IsSelected ? 1 : 0;
|
Control.Send("write", this.light, 3);
|
})
|
{ IsBackground = true }.Start();
|
};
|
|
}
|
|
}
|
}
|