diff --git a/README.md b/README.md index 3f1cdc17..a376d1f4 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ To see how to deploy the application, please refer to the deployment guide: [Dep For a full documentation on how to deploy the application on a raspberry with GPIO enable see [Rpi guide](https://github.com/Lionk-Framework/Lionk-documentation/wiki/Deploy-on-a-raspberry-with-docker) -Some basic plugins for raspberry can be found [here](https://github.com/Lionk-Framework/Lionk-rpi-components/releases/tag/RPI_Plugins_1.0.0) +Some basic plugins for raspberry can be found [here](https://github.com/Lionk-Framework/Lionk-rpi-components/releases/tag/RPI_Plugins_1.0.1) ### 🤖 Usage To see how to use the application, please refer to the user guide: [User guide](https://github.com/Lionk-Framework/Lionk-documentation/wiki/User-guide). diff --git a/src/Lib/Lionk.Core.Razor/Views/CyclicComponent/CyclicComponentCard.razor b/src/Lib/Lionk.Core.Razor/Views/CyclicComponent/CyclicComponentCard.razor index 554f1016..a944ec5d 100644 --- a/src/Lib/Lionk.Core.Razor/Views/CyclicComponent/CyclicComponentCard.razor +++ b/src/Lib/Lionk.Core.Razor/Views/CyclicComponent/CyclicComponentCard.razor @@ -9,11 +9,22 @@ - + Period: - @Component.Period + @if (_editPeriod) + { + + } + else + { + @Component.Period + } + + + + @@ -22,6 +33,7 @@ @Component.NbCycle + @if (Component.IsInError) @@ -41,7 +53,21 @@ /// The cyclic component to display. /// [Parameter] - public ICyclicComponent? Component { get; set; } + public ICyclicComponent Component { get; set; } = null!; + private bool _editPeriod = false; + private string _icon => _editPeriod ? Icons.Material.Filled.Done : Icons.Material.Filled.Edit; + private string _adornmentText => _editPeriod ? "Lock edit" : "Edit period"; + private double _seconde + { + get => Component.Period.TotalSeconds; + set => Component.Period = TimeSpan.FromSeconds(value); + } + + private void ButtonPeriodClick() + { + _editPeriod = !_editPeriod; + InvokeAsync(StateHasChanged); + } private void ResetComponent() => Component?.Reset(); diff --git a/src/Lib/Lionk.Core/Model/Services/ComponentService/ComponentService.cs b/src/Lib/Lionk.Core/Model/Services/ComponentService/ComponentService.cs index c98fe768..fad4d848 100644 --- a/src/Lib/Lionk.Core/Model/Services/ComponentService/ComponentService.cs +++ b/src/Lib/Lionk.Core/Model/Services/ComponentService/ComponentService.cs @@ -188,6 +188,18 @@ private void LoadConfiguration() } _componentInstances = DeserializeComponents(jsonObject); + SubscribeObservableComponents(); + } + + private void SubscribeObservableComponents() + { + foreach (IComponent component in _componentInstances.Values) + { + if (component is ObservableElement observable) + { + observable.PropertyChanged += (s, e) => RequestSaveConfiguration(); + } + } } private JObject? ParseJson(string json)