| | |
| | | void LoadEventList() |
| | | { |
| | | LoadColorChangeEvent(); |
| | | LoadCollectionEvent(); |
| | | LoadSwitchEvent(); |
| | | |
| | | //回退刷新信息事件 |
| | | actionRefresh = () => { |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = light.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | /// <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(); |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |