| | |
| | | /// </summary> |
| | | public static void UpdataState(Function updataTemp) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((Action)(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | return; |
| | | if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid) |
| | | { |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updataTemp.trait_on_off.state.ToString() == "on"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"RelayPage error {ex.Message}"); |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | /// <summary> |
| | | /// 加载事件列表 |
| | |
| | | btnSwitch.IsSelected = btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitchIcon.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitchIcon.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | btnSwitchIcon.IsSelected = btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | function.trait_on_off.state = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", function.trait_on_off.curValue.ToString()); |
| | | d.Add("on_off", function.trait_on_off.state.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |