web UI
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
16
VisionBuilder.UI.Blazor/Services/BlazorLoadingService.cs
Normal file
16
VisionBuilder.UI.Blazor/Services/BlazorLoadingService.cs
Normal 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.
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
40
VisionBuilder.UI.Blazor/Services/BlazorSettingsService.cs
Normal file
40
VisionBuilder.UI.Blazor/Services/BlazorSettingsService.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user