85 lines
3.3 KiB
Plaintext
85 lines
3.3 KiB
Plaintext
@implements IDisposable
|
|
|
|
<div class="d-flex w-100 h-100 flex-column">
|
|
<EditForm EditContext="EditContext">
|
|
<DataAnnotationsValidator />
|
|
|
|
<div class="form-check mb-2">
|
|
<InputCheckbox class="form-check-input" @bind-Value="Model.EnableSimulation" />
|
|
<label class="form-check-label">Enable Simulation</label>
|
|
<ValidationMessage For="@(() => Model.EnableSimulation)" />
|
|
</div>
|
|
|
|
<div class="row g-2 mb-2">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Max Velocity (m/s)</label>
|
|
<InputNumber class="form-control" @bind-Value="Model.SimulationMaxVelocity" />
|
|
<ValidationMessage For="@(() => Model.SimulationMaxVelocity)" />
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Max Angular Velocity (rad/s)</label>
|
|
<InputNumber class="form-control" @bind-Value="Model.SimulationMaxAngularVelocity" />
|
|
<ValidationMessage For="@(() => Model.SimulationMaxAngularVelocity)" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row g-2 mb-2">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Acceleration (m/s²)</label>
|
|
<InputNumber class="form-control" @bind-Value="Model.SimulationAcceleration" />
|
|
<ValidationMessage For="@(() => Model.SimulationAcceleration)" />
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Deceleration (m/s²)</label>
|
|
<InputNumber class="form-control" @bind-Value="Model.SimulationDeceleration" />
|
|
<ValidationMessage For="@(() => Model.SimulationDeceleration)" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-2">
|
|
<label class="form-label">Description</label>
|
|
<InputTextArea class="form-control" @bind-Value="Model.Description" />
|
|
<ValidationMessage For="@(() => Model.Description)" />
|
|
</div>
|
|
</EditForm>
|
|
<div class="flex-grow-1" />
|
|
<div>
|
|
@if (Model.CreatedAt != default || Model.UpdatedAt != default)
|
|
{
|
|
<div class="d-flex justify-content-end mt-2">
|
|
<small class="text-muted">Created: @Model.CreatedAt.ToString("dd/MM/yyyy HH:mm:ss")</small>
|
|
<small class="text-muted ms-3">Updated: @Model.UpdatedAt.ToString("dd/MM/yyyy HH:mm:ss")</small>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public RobotSimulationConfigDto Model { get; set; } = new();
|
|
|
|
[Parameter]
|
|
public EventCallback<RobotSimulationConfigDto> ModelChanged { get; set; }
|
|
|
|
private EditContext? EditContext;
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
if (EditContext is null || !EditContext.Model!.Equals(Model))
|
|
{
|
|
if (EditContext is not null) EditContext.OnFieldChanged -= EditContext_OnFieldChanged;
|
|
EditContext = new EditContext(Model);
|
|
EditContext.OnFieldChanged += EditContext_OnFieldChanged;
|
|
}
|
|
}
|
|
|
|
private void EditContext_OnFieldChanged(object? sender, FieldChangedEventArgs e)
|
|
{
|
|
_ = ModelChanged.InvokeAsync(Model);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (EditContext is not null) EditContext.OnFieldChanged -= EditContext_OnFieldChanged;
|
|
}
|
|
} |