| | |
| | | using System; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using Shared; |
| | | |
| | |
| | | /// <summary> |
| | | /// 更新灯光状态 |
| | | /// </summary> |
| | | public static void UpdataState(SwitchSocket uFan) |
| | | public static void UpdataState(Function uFan) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | { |
| | | if (bodyView == null) |
| | | return; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.value.ToString() == "on"; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.curValue.ToString() == "on"; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | //回退刷新信息事件 |
| | | actionRefresh = () => { |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = socketFunction.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = socketFunction.GetRoomListName(); |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = function.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); |
| | | function.UpdataFuncitonInfo(); |
| | | }; |
| | | } |
| | | |
| | |
| | | void LoadCollectionEvent() |
| | | { |
| | | btnCollection.MouseUpEventHandler += (sender, e) => { |
| | | btnCollection.IsSelected = socketFunction.collection = btnCollection_Out.IsSelected = !btnCollection.IsSelected; |
| | | socketFunction.SaveFunctionData(); |
| | | btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; |
| | | function.CollectFunction(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | btnSwitchIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected; |
| | | btnSwitchIcon.IsSelected = btnSwitch.IsSelected = !btnSwitchIcon.IsSelected; |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | socketFunction.trait_on_off.value = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.socketFunction); |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", socketFunction.trait_on_off.value.ToString()); |
| | | Control.SendWriteCommand(socketFunction, d); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | btnSwitch.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | btnSwitch.IsSelected = btnSwitchIcon.IsSelected = !btnSwitch.IsSelected; |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | socketFunction.trait_on_off.value = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.socketFunction); |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | //Control.Send(CommandType_A.write, this.function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", socketFunction.trait_on_off.value.ToString()); |
| | | Control.SendWriteCommand(socketFunction, d); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |