Aggiunta UI Blazor moderna e animazioni per AutoBidder
Introdotta una nuova interfaccia utente Blazor Server moderna, dark e responsive, con sidebar di navigazione, statistiche animate, banner utente, gestione stato aste e browser integrato. Aggiunti servizi per stato aste e impostazioni, ampio set di stili CSS e animazioni, integrazione JS per l'iframe browser, nuovi layout e configurazione di avvio per sviluppo e produzione. L'app è ora pronta per un'esperienza web professionale e cross-platform.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using AutoBidder.Models;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace AutoBidder.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Servizio per gestione stato aste in ambiente Blazor
|
||||
/// </summary>
|
||||
public class AuctionStateService
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, AuctionInfo> _auctions = new();
|
||||
|
||||
public event Action? OnStateChanged;
|
||||
public event Action<string>? OnAuctionUpdated;
|
||||
public event Action<string>? OnAuctionAdded;
|
||||
public event Action<string>? OnAuctionRemoved;
|
||||
|
||||
public IEnumerable<AuctionInfo> GetAllAuctions() => _auctions.Values;
|
||||
|
||||
public AuctionInfo? GetAuction(string auctionId)
|
||||
{
|
||||
_auctions.TryGetValue(auctionId, out var auction);
|
||||
return auction;
|
||||
}
|
||||
|
||||
public void AddAuction(AuctionInfo auction)
|
||||
{
|
||||
if (_auctions.TryAdd(auction.AuctionId, auction))
|
||||
{
|
||||
OnAuctionAdded?.Invoke(auction.AuctionId);
|
||||
NotifyStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveAuction(string auctionId)
|
||||
{
|
||||
if (_auctions.TryRemove(auctionId, out _))
|
||||
{
|
||||
OnAuctionRemoved?.Invoke(auctionId);
|
||||
NotifyStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAuction(string auctionId, Action<AuctionInfo> updateAction)
|
||||
{
|
||||
if (_auctions.TryGetValue(auctionId, out var auction))
|
||||
{
|
||||
updateAction(auction);
|
||||
OnAuctionUpdated?.Invoke(auctionId);
|
||||
NotifyStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifyStateChanged() => OnStateChanged?.Invoke();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user