This commit is contained in:
EugeneTes
2026-03-19 09:03:37 +01:00
parent 14fe822962
commit 83597b8763
55 changed files with 2136 additions and 32 deletions

View File

@@ -0,0 +1,34 @@
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;
}
}

View File

@@ -0,0 +1,16 @@
using VisionBuilder.UI.Common.Processing;
namespace VisionBuilder.UI.Blazor.Services;
public class BlazorLoadingService : ILoadingService
{
public void StartLoading(string title)
{
// Loading indicator managed at the Blazor host level if needed.
}
public void StopLoading(string title)
{
// Loading indicator managed at the Blazor host level if needed.
}
}

View File

@@ -0,0 +1,27 @@
using MudBlazor;
using VisionBuilder.UI.Blazor.Dialogs;
using VisionBuilder.UI.Common.Services;
namespace VisionBuilder.UI.Blazor.Services;
public class BlazorPasswordInputService : IPasswordInputService
{
private IDialogService? _dialogService;
public void SetDialogService(IDialogService dialogService)
{
_dialogService = dialogService;
}
public async Task<string?> GetPasswordAsync()
{
if (_dialogService == null)
return null;
var dialog = await _dialogService.ShowAsync<PasswordInputDialog>("Password Required");
var result = await dialog.Result;
if (result != null && !result.Canceled)
return result.Data as string;
return null;
}
}

View File

@@ -0,0 +1,30 @@
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 BlazorRecipeSelectionDialogService : IRecipeSelectionDialogService
{
private IDialogService? _dialogService;
public void SetDialogService(IDialogService dialogService)
{
_dialogService = dialogService;
}
public async Task<bool> SelectRecipeAsync(RecipeSelectionVM recipeSelectionVm)
{
if (_dialogService == null)
return false;
var parameters = new DialogParameters<RecipeSelectionDialog>
{
{ x => x.ViewModel, recipeSelectionVm }
};
var dialog = await _dialogService.ShowAsync<RecipeSelectionDialog>("Select Recipe", parameters);
var result = await dialog.Result;
return result != null && !result.Canceled;
}
}

View File

@@ -0,0 +1,40 @@
using Inspectron.Settings;
using MudBlazor;
using VisionBuilder.UI.Blazor.Dialogs;
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
namespace VisionBuilder.UI.Blazor.Services;
public class BlazorSettingsService : ISettingsService
{
private readonly InspectronSettings _settings;
private IDialogService? _dialogService;
public BlazorSettingsService(InspectronSettings settings)
{
_settings = settings;
}
public void SetDialogService(IDialogService dialogService)
{
_dialogService = dialogService;
}
public async Task ShowSettingsDialogAsync()
{
if (_dialogService == null)
return;
var parameters = new DialogParameters<SettingsDialog>
{
{ x => x.Settings, _settings }
};
var options = new DialogOptions
{
MaxWidth = MaxWidth.Medium,
FullWidth = true
};
var dialog = await _dialogService.ShowAsync<SettingsDialog>("Settings", parameters, options);
await dialog.Result;
}
}