mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-24 20:12:20 +00:00
30 lines
863 B
Plaintext
30 lines
863 B
Plaintext
<h3>OptionBase</h3>
|
|
@typeparam T
|
|
@code {
|
|
[Parameter]
|
|
public required string Name { get; init; }
|
|
[Parameter]
|
|
public required string Description { get; init; }
|
|
[Parameter]
|
|
public required OptionInstance Instance { get; init; }
|
|
[Parameter]
|
|
public required OptionProperty Property { get; init; }
|
|
[Parameter]
|
|
public required Action ValueChanged { get; init; }
|
|
|
|
public T? Value { get; set; }
|
|
|
|
protected virtual T? ConvertValue(OptionInstance optionInstance, OptionProperty property) { throw new InvalidOperationException("Converter is not implemented"); }
|
|
|
|
protected override Task OnParametersSetAsync()
|
|
{
|
|
this.Value = this.ConvertValue(this.Instance, this.Property);
|
|
return base.OnParametersSetAsync();
|
|
}
|
|
|
|
protected void NotifyValueChanged()
|
|
{
|
|
this.ValueChanged();
|
|
}
|
|
}
|