Skip to content

Commit

Permalink
Merge pull request #291 from AlexandreIorio/dev
Browse files Browse the repository at this point in the history
Fix and feature
  • Loading branch information
CoJaques authored Oct 15, 2024
2 parents ed1b0b1 + fc51b46 commit cbe0a91
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,22 @@
</MudText>
<MudDivider Light="true" DividerType="DividerType.Middle" />
<MudGrid>
<MudItem xs="6">
<MudItem xs="3">
<MudText Typo="Typo.body2">Period:</MudText>
</MudItem>
<MudItem xs="6" class="text-right">
<MudText Typo="Typo.body2">@Component.Period</MudText>
@if (_editPeriod)
{
<MudTextField T="double" @bind-Value="_seconde" Variant="Variant.Filled" Label="Period [s]"/>
}
else
{
<MudText Typo="Typo.body2">@Component.Period</MudText>
}
</MudItem>

<MudItem xs="3">
<MudButton StartIcon="@_icon" OnClick="ButtonPeriodClick" IconSize="Size.Small"/>
</MudItem>

<MudItem xs="6">
Expand All @@ -22,6 +33,7 @@
<MudItem xs="6" class="text-right">
<MudText Typo="Typo.body2">@Component.NbCycle</MudText>
</MudItem>

</MudGrid>
</MudCardContent>
@if (Component.IsInError)
Expand All @@ -41,7 +53,21 @@
/// The cyclic component to display.
/// </summary>
[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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cbe0a91

Please sign in to comment.