35 lines
974 B
C#
35 lines
974 B
C#
using MudBlazor;
|
|
using VisionBuilder.UI.Blazor.Dialogs;
|
|
using VisionBuilder.UI.Common.ViewModel;
|
|
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
|
|
|
|
namespace VisionBuilder.UI.Blazor.Services;
|
|
|
|
public class BlazorImagePreviewService : IImagePreviewService
|
|
{
|
|
private IDialogService? _dialogService;
|
|
|
|
public void SetDialogService(IDialogService dialogService)
|
|
{
|
|
_dialogService = dialogService;
|
|
}
|
|
|
|
public async Task ShowImagePreviewAsync(ErrorPreviewVM errorPreviewVm)
|
|
{
|
|
if (_dialogService == null)
|
|
return;
|
|
|
|
var parameters = new DialogParameters<ImagePreviewDialog>
|
|
{
|
|
{ x => x.ViewModel, errorPreviewVm }
|
|
};
|
|
var options = new DialogOptions
|
|
{
|
|
MaxWidth = MaxWidth.Large,
|
|
FullWidth = true
|
|
};
|
|
var dialog = await _dialogService.ShowAsync<ImagePreviewDialog>("Image Preview", parameters, options);
|
|
await dialog.Result;
|
|
}
|
|
}
|