I have a page that opens a dialog on a button click
protected async Task LoadDetails(int loadId)
{
await DialogService.OpenAsync<LoadDetail>("Load Detail",
new Dictionary<string, object> { { "Id", loadId } });
}
Load Detail opens a dialog of it's own
protected async Task OpenScannerModal(Vehicle vehicle)
{
var result = await DialogService.OpenAsync<ScannerAnylineBarcode>("Scanner");
if (result != null)
{
var scannedVin = result.ToString();
bool isDefaultVin = vehicle.VIN.All(c => c == '?');
if (isDefaultVin)
{
vehicle.VIN = scannedVin;
vehicle = await LoadVehicleMethods.VinDecode(vehicle);
await loadVehicleMethods.Rate(vehicle, SqlDatabaseService, Security);
await loadVehicleMethods.MilesAndWeightLookups(vehicle, SqlDatabaseService);
vehicle.Verified = true;
await SqlDatabaseService.UpdateVehicle(vehicle.Id, vehicle);
}
else if (vehicle.VIN == scannedVin)
{
vehicle.Verified = true;
await SqlDatabaseService.UpdateVehicle(vehicle.Id, vehicle);
}
await GetLoadVehicles();
StateHasChanged();
}
}
ScannerAnylineBarcode is a scanner, once the scanner finds something, it closes and sends the value back to LoadDetail
[JSInvokable]
public async Task OnScanCompleted(string vinResult)
{
await InvokeAsync(() => DialogService.Close(vinResult));
}
this does not work as expected and hence this post.
what I need is for LoadDetail page to stay open and ScannerAnylineBarcode to close. it does not work, it's hard to understand what actual happens, ScannerAnylineBarcode closes, but so does LoadDetail or it hides behind the main page or something, the "dialog/modal stack" doesn't behave like you'd think it should/like I need it to.
any ideas?
Thank you