Add device detection and PDF generation features; refactor AuthDialog and update print utilities
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
namespace FrontOffice.Main.Utilities;
|
||||
@@ -6,17 +5,25 @@ namespace FrontOffice.Main.Utilities;
|
||||
public class AuthDialogService
|
||||
{
|
||||
private readonly IDialogService _dialogService;
|
||||
private readonly DialogOptions _maxWidth = new() { MaxWidth = MaxWidth.Medium, FullWidth = true, };
|
||||
private readonly IDeviceDetector _deviceDetector;
|
||||
private readonly DialogOptions _normalWidth = new() { MaxWidth = MaxWidth.ExtraSmall, FullWidth = true };
|
||||
|
||||
public AuthDialogService(IDialogService dialogService)
|
||||
public AuthDialogService(IDialogService dialogService, IDeviceDetector deviceDetector)
|
||||
{
|
||||
_dialogService = dialogService;
|
||||
ArgumentNullException.ThrowIfNull(dialogService);
|
||||
ArgumentNullException.ThrowIfNull(deviceDetector);
|
||||
_dialogService = dialogService!;
|
||||
_deviceDetector = deviceDetector!;
|
||||
}
|
||||
|
||||
public async Task ShowAuthDialogAsync()
|
||||
{
|
||||
|
||||
var dialog = await _dialogService.ShowAsync<Shared.AuthDialog>("ورود به حساب کاربری",_maxWidth);
|
||||
// Pick dialog size based on device type
|
||||
var options = _deviceDetector.IsMobile()
|
||||
? new DialogOptions() { FullScreen = true}
|
||||
: _normalWidth;
|
||||
|
||||
var dialog = await _dialogService.ShowAsync<Shared.AuthDialog>("ورود به حساب کاربری", options);
|
||||
var result = await dialog.Result;
|
||||
|
||||
if (!result.Canceled)
|
||||
|
||||
Reference in New Issue
Block a user