UI_SequentMicrosystems-RPI/Components/MainLayoutPointsTopBar.razor

66 lines
1.7 KiB
Plaintext
Raw Normal View History

@using UI_SequentMicrosystems.Services
@inject PointsService _PointsService
@inject IJSRuntime _JSRuntime
<div class="row text-center">
<div class="col">
<button class="btn btn-dark text-white no-border" @onclick="(() => _PointsService.SavePoint())">Save Point (@_PointsService.GetPointsCount())</button>
</div>
<div class="col row">
<div class="col-md-3 col">
<button class="btn btn-dark text-white no-border" @onclick="(() => DownloadFile())">Export as CSV</button>
</div>
<div class="col-md-3 col text-start align-self-center">
<div class="form-check form-switch">
@if (RecalculateValues)
{
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault" @onclick="(() =>
{
RecalculateValues = false;
})" checked>
}
else
{
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault" @onclick="(() => RecalculateValues = true)">
}
<label class="form-check-label" for="flexSwitchCheckDefault">Recalculate Values?</label>
</div>
</div>
</div>
</div>
@code {
private bool RecalculateValues = false;
private async void DownloadFile()
{
// Název souboru
string fileName = "TESDevice1.csv";
// Vytvoření a spuštění odkazu ke stažení
await _JSRuntime.InvokeVoidAsync("DownloadFile", fileName, await _PointsService.CreatePointsFileLines(RecalculateValues));
}
}