();
- }
-
- private async Task RefreshData()
- {
- LoadMockData();
- await JSRuntime.InvokeVoidAsync("alert", "?? Funzionalità in sviluppo. I dati verranno aggiornati nella prossima versione.");
- }
-
- private void ShowInfoModal()
- {
- showInfoModal = true;
- }
-
- private void CloseInfoModal()
- {
- showInfoModal = false;
- }
-
- private async Task UseFreeBids(FreeBidAuction auction)
- {
- await JSRuntime.InvokeVoidAsync("alert", $"?? Funzionalità in sviluppo.\n\nSarà possibile utilizzare le puntate gratuite su: {auction.ProductName}");
- }
-
- private async Task ViewDetails(FreeBidAuction auction)
- {
- await JSRuntime.InvokeVoidAsync("alert", $"?? Dettagli Asta\n\nProdotto: {auction.ProductName}\nPuntate Gratuite: {auction.FreeBidsAvailable}\nPrezzo: €{auction.CurrentPrice:F2}\nScadenza: {auction.ExpiryTime:dd/MM/yyyy HH:mm}");
- }
-
- private async Task SaveConfiguration()
- {
- await JSRuntime.InvokeVoidAsync("alert", "?? Configurazione sarà disponibile nella prossima versione.");
- }
-
- private string GetStatusBadgeClass(string status)
- {
- return status switch
- {
- "Disponibile" => "bg-success",
- "In Uso" => "bg-warning text-dark",
- "Scaduta" => "bg-danger",
- "Completata" => "bg-info",
- _ => "bg-secondary"
- };
- }
-
- // Model
- private class FreeBidAuction
- {
- public string ProductName { get; set; } = "";
- public int FreeBidsAvailable { get; set; }
- public DateTime ExpiryTime { get; set; }
- public decimal CurrentPrice { get; set; }
- public string Status { get; set; } = "Disponibile";
- }
-}
diff --git a/Mimante/Pages/Health.razor b/Mimante/Pages/Health.razor
new file mode 100644
index 0000000..bed29e2
--- /dev/null
+++ b/Mimante/Pages/Health.razor
@@ -0,0 +1,35 @@
+@page "/health"
+@inject DatabaseService DatabaseService
+@inject AuctionMonitor AuctionMonitor
+
+@code {
+ protected override async Task OnInitializedAsync()
+ {
+ try
+ {
+ // Verifica database
+ var dbHealthy = await DatabaseService.CheckDatabaseHealthAsync();
+
+ // Verifica servizi
+ var auctionsCount = AuctionMonitor.GetAuctions().Count;
+
+ if (dbHealthy)
+ {
+ // Ritorna 200 OK
+ await Task.CompletedTask;
+ }
+ else
+ {
+ // Ritorna 500 Internal Server Error
+ throw new Exception("Database health check failed");
+ }
+ }
+ catch
+ {
+ // Healthcheck fallito
+ throw;
+ }
+ }
+}
+
+OK
diff --git a/Mimante/Pages/Index.razor b/Mimante/Pages/Index.razor
index f38476e..df24b51 100644
--- a/Mimante/Pages/Index.razor
+++ b/Mimante/Pages/Index.razor
@@ -48,8 +48,10 @@
Prezzo
Timer
Ultimo
- Reset
Click
+ Totale
+ Risparmio
+ OK?
Azioni
@@ -68,8 +70,10 @@
@GetPriceDisplay(auction)
@GetTimerDisplay(auction)
@GetLastBidder(auction)
- @auction.ResetCount
@GetMyBidsCount(auction)
+ @GetTotalCostDisplay(auction)
+ @GetSavingsDisplay(auction)
+ @GetIsWorthItIcon(auction)
@if (auction.IsActive && !auction.IsPaused)
@@ -103,23 +107,42 @@
}
+
+
+
+
Log Globale
+
+
+
+
+
+ @if (globalLog.Count == 0)
+ {
+
Nessun log ancora...
+ }
+ else
+ {
+ @foreach (var logEntry in globalLog.TakeLast(100))
+ {
+
@logEntry
+ }
+ }
+
+
+
+
@if (selectedAuction != null)
{
-
-
-
@selectedAuction.Name
-
- @GetStatusIcon(selectedAuction) @GetStatusText(selectedAuction)
-
-
+
+
@selectedAuction.Name
ID: @selectedAuction.AuctionId
-
+
URL:
- CopyToClipboard(selectedAuction.OriginalUrl)" title="Copia">
+ CopyToClipboard(selectedAuction.OriginalUrl)" title="Copia">
@@ -127,160 +150,150 @@
-
-
-
-
Log Asta
-
- @if (GetAuctionLog(selectedAuction).Any())
- {
- @foreach (var logEntry in GetAuctionLog(selectedAuction))
- {
-
@logEntry
- }
- }
- else
- {
-
Nessun log disponibile
- }
-
-
-
-
-
Partecipanti (@selectedAuction.BidderStats.Count)
- @if (selectedAuction.BidderStats.Count == 0)
+
+ @* ?? NUOVO: Sezione Valore Prodotto *@
+ @if (selectedAuction.CalculatedValue != null)
{
-
Nessun partecipante ancora
- }
- else
- {
-
-
-
-
- Utente
- Puntate
- Ultima
-
-
-
- @foreach (var bidder in selectedAuction.BidderStats.Values.OrderByDescending(b => b.BidCount))
- {
-
- @bidder.Username
- @bidder.BidCount
- @bidder.LastBidTimeDisplay
-
- }
-
-
+
+
Valore Prodotto
+
+
+
+
+
+ Prezzo Compra Subito
+ @GetBuyNowPriceDisplay(selectedAuction)
+
+
+
+
+
+
+ Costo Totale
+ @GetTotalCostDisplay(selectedAuction)
+
+
+
+
+
+
+ Risparmio
+ @GetSavingsDisplay(selectedAuction)
+
+
+
+
+
+
+ Conveniente?
+
+ @GetIsWorthItIcon(selectedAuction)
+
+
+
+
+
+ @if (!string.IsNullOrEmpty(selectedAuction.CalculatedValue.Summary))
+ {
+
+ @selectedAuction.CalculatedValue.Summary
+
+ }
}
}
else
{
-
-
-
-
Seleziona un'asta
-
Clicca su un'asta dalla lista per visualizzare i dettagli
+
+
+
+
Seleziona un'asta per i dettagli
}
-
-
-
Log Globale
-
- Pulisci
-
-
-
- @if (globalLog.Count == 0)
- {
-
Nessun log ancora...
- }
- else
- {
- @foreach (var logEntry in globalLog.TakeLast(100))
- {
-
@logEntry
- }
- }
-
-
-
-
-
-@if (showAddDialog)
-{
-
-
-
-
-
-
-
URL Asta:
-
- @if (addDialogError != null)
- {
-
- @addDialogError
-
- }
-
- Inserisci l'URL completo dell'asta da Bidoo.com
-
+
+ @if (showAddDialog)
+ {
+
+
+
+
-
-
-
Nome Asta (opzionale):
-
+
+
+
URL Asta:
+
+ @if (addDialogError != null)
+ {
+
+ @addDialogError
+
+ }
+
+ Inserisci l'URL completo dell'asta da Bidoo.com
+
+
+
+
+ Nome Asta (opzionale):
+
+
+
+
-
-
-
-}
+ }
+
diff --git a/Mimante/Pages/Index.razor.cs b/Mimante/Pages/Index.razor.cs
index 052d3dd..c55cba5 100644
--- a/Mimante/Pages/Index.razor.cs
+++ b/Mimante/Pages/Index.razor.cs
@@ -35,7 +35,10 @@ namespace AutoBidder.Pages
await InvokeAsync(StateHasChanged);
}, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1));
- AddLog("Applicazione avviata");
+ AddLog("? Applicazione avviata");
+
+ // Applica logica auto-start in base alle impostazioni
+ ApplyAutoStartLogic();
}
private void LoadAuctionsFromDisk()
@@ -50,7 +53,78 @@ namespace AutoBidder.Pages
if (loadedAuctions.Count > 0)
{
- AddLog($"Caricate {loadedAuctions.Count} aste salvate");
+ AddLog($"?? Caricate {loadedAuctions.Count} aste salvate");
+ }
+ }
+
+ private void ApplyAutoStartLogic()
+ {
+ var settings = AutoBidder.Utilities.SettingsManager.Load();
+
+ if (settings.RememberAuctionStates)
+ {
+ // Modalità "Ricorda Stato": mantiene lo stato salvato di ogni asta
+ var activeCount = auctions.Count(a => a.IsActive && !a.IsPaused);
+ if (activeCount > 0)
+ {
+ AuctionMonitor.Start();
+ isMonitoringActive = true;
+ AddLog($"?? [REMEMBER STATE] Ripristinato stato salvato: {activeCount} aste attive");
+ }
+ else
+ {
+ AddLog("?? [REMEMBER STATE] Nessuna asta attiva salvata");
+ }
+ }
+ else
+ {
+ // Modalità "Default": applica DefaultStartAuctionsOnLoad a tutte le aste
+ switch (settings.DefaultStartAuctionsOnLoad)
+ {
+ case "Active":
+ // Avvia tutte le aste
+ foreach (var auction in auctions)
+ {
+ auction.IsActive = true;
+ auction.IsPaused = false;
+ }
+ if (auctions.Count > 0)
+ {
+ AuctionMonitor.Start();
+ isMonitoringActive = true;
+ SaveAuctions();
+ AddLog($"?? [AUTO-START] Avviate automaticamente {auctions.Count} aste");
+ }
+ break;
+
+ case "Paused":
+ // Mette in pausa tutte le aste
+ foreach (var auction in auctions)
+ {
+ auction.IsActive = true;
+ auction.IsPaused = true;
+ }
+ if (auctions.Count > 0)
+ {
+ AuctionMonitor.Start();
+ isMonitoringActive = true;
+ SaveAuctions();
+ AddLog($"?? [AUTO-START] Aste in pausa: {auctions.Count}");
+ }
+ break;
+
+ case "Stopped":
+ default:
+ // Ferma tutte le aste (default)
+ foreach (var auction in auctions)
+ {
+ auction.IsActive = false;
+ auction.IsPaused = false;
+ }
+ SaveAuctions();
+ AddLog($"?? [AUTO-START] Aste fermate all'avvio: {auctions.Count}");
+ break;
+ }
}
}
@@ -77,6 +151,9 @@ namespace AutoBidder.Pages
var auction = auctions.FirstOrDefault(a => a.AuctionId == state.AuctionId);
if (auction != null)
{
+ // Salva l'ultimo stato ricevuto
+ auction.LastState = state;
+
InvokeAsync(StateHasChanged);
}
}
@@ -129,10 +206,12 @@ namespace AutoBidder.Pages
auction.IsActive = true;
auction.IsPaused = false;
+ // Auto-start monitor se non attivo
if (!isMonitoringActive)
{
AuctionMonitor.Start();
isMonitoringActive = true;
+ AddLog("[AUTO-START] Monitoraggio avviato");
}
SaveAuctions();
@@ -159,6 +238,14 @@ namespace AutoBidder.Pages
auction.IsPaused = false;
SaveAuctions();
AddLog($"?? Fermata asta: {auction.Name}");
+
+ // Auto-stop monitor se nessuna asta è attiva
+ if (!auctions.Any(a => a.IsActive))
+ {
+ AuctionMonitor.Stop();
+ isMonitoringActive = false;
+ AddLog("[AUTO-STOP] Monitoraggio fermato");
+ }
}
// Dialog Aggiungi Asta
@@ -204,31 +291,75 @@ namespace AutoBidder.Pages
// Carica impostazioni default
var settings = AutoBidder.Utilities.SettingsManager.Load();
- // Crea nuova asta
+ // Determina stato iniziale in base a DefaultNewAuctionState
+ bool isActive = false;
+ bool isPaused = false;
+
+ switch (settings.DefaultNewAuctionState)
+ {
+ case "Active":
+ isActive = true;
+ isPaused = false;
+ break;
+ case "Paused":
+ isActive = true;
+ isPaused = true;
+ break;
+ case "Stopped":
+ default:
+ isActive = false;
+ isPaused = false;
+ break;
+ }
+
+ // Crea nuova asta con nome temporaneo
+ var tempName = string.IsNullOrWhiteSpace(addDialogName) ? $"Caricamento... (ID: {auctionId})" : addDialogName;
+
var newAuction = new AuctionInfo
{
AuctionId = auctionId,
- Name = string.IsNullOrWhiteSpace(addDialogName) ? $"Asta {auctionId}" : addDialogName,
+ Name = tempName,
OriginalUrl = addDialogUrl,
BidBeforeDeadlineMs = settings.DefaultBidBeforeDeadlineMs,
CheckAuctionOpenBeforeBid = settings.DefaultCheckAuctionOpenBeforeBid,
MinPrice = settings.DefaultMinPrice,
MaxPrice = settings.DefaultMaxPrice,
MaxClicks = settings.DefaultMaxClicks,
- IsActive = false,
- IsPaused = false
+ MinResets = settings.DefaultMinResets,
+ MaxResets = settings.DefaultMaxResets,
+ IsActive = isActive,
+ IsPaused = isPaused
};
auctions.Add(newAuction);
AuctionMonitor.AddAuction(newAuction);
SaveAuctions();
- AddLog($"? Aggiunta asta: {newAuction.Name} (ID: {auctionId})");
+ // Log stato iniziale
+ string stateLabel = settings.DefaultNewAuctionState switch
+ {
+ "Active" => "?? Attiva",
+ "Paused" => "?? In Pausa",
+ _ => "?? Fermata"
+ };
+
+ AddLog($"? Aggiunta asta: {newAuction.Name} (ID: {auctionId}) - Stato: {stateLabel}");
+
+ // Auto-start monitor se necessario
+ if (isActive && !isMonitoringActive)
+ {
+ AuctionMonitor.Start();
+ isMonitoringActive = true;
+ AddLog("[AUTO-START] Monitoraggio avviato per nuova asta attiva");
+ }
CloseAddDialog();
selectedAuction = newAuction;
+
+ // ?? TODO: Implementare caricamento nome e info prodotto in background
+ // Richiede aggiunta metodo GetAuctionHtmlAsync a BidooApiClient
}
-
+
private string ExtractAuctionId(string url)
{
try
@@ -309,36 +440,194 @@ namespace AutoBidder.Pages
return "status-active";
}
- private string GetPriceDisplay(AuctionInfo auction)
+ private string GetPriceDisplay(AuctionInfo? auction)
{
- if (auction.CalculatedValue?.CurrentPrice > 0)
- return $"€{auction.CalculatedValue.CurrentPrice:F2}";
+ try
+ {
+ if (auction == null) return "-";
+
+ // Prova a leggere da LastState prima
+ if (auction.LastState != null && auction.LastState.Price > 0)
+ return $"€{auction.LastState.Price:F2}";
+
+ // Fallback a CalculatedValue
+ if (auction.CalculatedValue?.CurrentPrice > 0)
+ return $"€{auction.CalculatedValue.CurrentPrice:F2}";
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"[ERROR] GetPriceDisplay: {ex.Message}");
+ }
+
return "-";
}
- private string GetPriceClass(AuctionInfo auction)
+ private string GetPriceClass(AuctionInfo? auction)
{
- if (auction.CalculatedValue?.CurrentPrice > 0)
- return "fw-bold text-success";
+ try
+ {
+ if (auction == null) return "text-muted";
+
+ double price = auction.LastState?.Price ?? auction.CalculatedValue?.CurrentPrice ?? 0;
+
+ if (price > 0)
+ return "fw-bold text-success";
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"[ERROR] GetPriceClass: {ex.Message}");
+ }
+
return "text-muted";
}
- private string GetTimerDisplay(AuctionInfo auction)
+ private string GetTimerDisplay(AuctionInfo? auction)
{
- // TODO: Get from latest state
+ try
+ {
+ if (auction == null) return "-";
+ if (auction.LastState == null || auction.LastState.Timer <= 0)
+ return "-";
+
+ var ts = TimeSpan.FromSeconds(auction.LastState.Timer);
+
+ if (ts.TotalHours >= 1)
+ return $"{(int)ts.TotalHours}h {ts.Minutes}m";
+ if (ts.TotalMinutes >= 1)
+ return $"{ts.Minutes}m {ts.Seconds}s";
+
+ return $"{ts.Seconds}s";
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"[ERROR] GetTimerDisplay: {ex.Message}");
+ }
+
return "-";
}
- private string GetLastBidder(AuctionInfo auction)
+ private string GetLastBidder(AuctionInfo? auction)
{
- return auction.RecentBids.FirstOrDefault()?.Username ?? "-";
+ try
+ {
+ if (auction == null) return "-";
+ return auction.RecentBids?.FirstOrDefault()?.Username ?? "-";
+ }
+ catch
+ {
+ return "-";
+ }
}
- private int GetMyBidsCount(AuctionInfo auction)
+ private int GetMyBidsCount(AuctionInfo? auction)
{
- return auction.BidHistory.Count(b => b.EventType == BidEventType.MyBid);
+ try
+ {
+ if (auction == null) return 0;
+ return auction.BidHistory?.Count(b => b?.EventType == BidEventType.MyBid) ?? 0;
+ }
+ catch
+ {
+ return 0;
+ }
}
-
+
+ // ?? NUOVI METODI: Visualizzazione valori prodotto
+
+ private string GetTotalCostDisplay(AuctionInfo? auction)
+ {
+ try
+ {
+ if (auction?.CalculatedValue != null)
+ {
+ return $"€{auction.CalculatedValue.TotalCostIfWin:F2}";
+ }
+ }
+ catch { }
+
+ return "-";
+ }
+
+ private string GetSavingsDisplay(AuctionInfo? auction)
+ {
+ try
+ {
+ if (auction?.CalculatedValue?.Savings.HasValue == true)
+ {
+ var savings = auction.CalculatedValue.Savings.Value;
+ var percentage = auction.CalculatedValue.SavingsPercentage ?? 0;
+
+ if (savings > 0)
+ return $"+€{savings:F2} ({percentage:F0}%)";
+ else
+ return $"-€{Math.Abs(savings):F2} ({Math.Abs(percentage):F0}%)";
+ }
+ }
+ catch { }
+
+ return "-";
+ }
+
+ private string GetSavingsClass(AuctionInfo? auction)
+ {
+ try
+ {
+ if (auction?.CalculatedValue?.Savings.HasValue == true)
+ {
+ return auction.CalculatedValue.Savings.Value > 0
+ ? "text-success fw-bold" // Verde per risparmio
+ : "text-danger fw-bold"; // Rosso per perdita
+ }
+ }
+ catch { }
+
+ return "text-muted";
+ }
+
+ private string GetBuyNowPriceDisplay(AuctionInfo? auction)
+ {
+ try
+ {
+ if (auction?.BuyNowPrice.HasValue == true)
+ {
+ return $"€{auction.BuyNowPrice.Value:F2}";
+ }
+ }
+ catch { }
+
+ return "-";
+ }
+
+ private string GetIsWorthItIcon(AuctionInfo? auction)
+ {
+ try
+ {
+ if (auction?.CalculatedValue != null)
+ {
+ return auction.CalculatedValue.IsWorthIt ? "?" : "?";
+ }
+ }
+ catch { }
+
+ return "-";
+ }
+
+ private string GetIsWorthItClass(AuctionInfo? auction)
+ {
+ try
+ {
+ if (auction?.CalculatedValue != null)
+ {
+ return auction.CalculatedValue.IsWorthIt
+ ? "badge bg-success"
+ : "badge bg-danger";
+ }
+ }
+ catch { }
+
+ return "badge bg-secondary";
+ }
+
private IEnumerable
GetAuctionLog(AuctionInfo auction)
{
return auction.AuctionLog.TakeLast(50);
@@ -346,11 +635,18 @@ namespace AutoBidder.Pages
private string GetLogEntryClass(string logEntry)
{
- if (logEntry.Contains("?") || logEntry.Contains("Errore") || logEntry.Contains("errore"))
- return "log-entry-error";
- if (logEntry.Contains("??") || logEntry.Contains("Warning") || logEntry.Contains("warning"))
- return "log-entry-warning";
- return "log-entry-new";
+ try
+ {
+ if (logEntry.Contains("[ERROR]") || logEntry.Contains("Errore") || logEntry.Contains("errore") || logEntry.Contains("FAIL"))
+ return "log-entry-error";
+ if (logEntry.Contains("[WARN]") || logEntry.Contains("Warning") || logEntry.Contains("warning"))
+ return "log-entry-warning";
+ if (logEntry.Contains("[OK]") || logEntry.Contains("SUCCESS") || logEntry.Contains("Vinta"))
+ return "log-entry-success";
+ }
+ catch { }
+
+ return "log-entry-info";
}
public void Dispose()
diff --git a/Mimante/Pages/Settings.razor b/Mimante/Pages/Settings.razor
index 59f4042..f5cc5db 100644
--- a/Mimante/Pages/Settings.razor
+++ b/Mimante/Pages/Settings.razor
@@ -2,6 +2,7 @@
@inject SessionService SessionService
@inject AuctionMonitor AuctionMonitor
@inject IJSRuntime JSRuntime
+@implements IDisposable
Impostazioni - AutoBidder
@@ -11,6 +12,7 @@
Impostazioni
+
@@ -72,7 +74,7 @@
@if (isConnecting)
{
-
+
Connessione...
}
else
@@ -85,6 +87,102 @@
+
+
+
+
+
+
+
+
+
+
+
Raccomandazioni:
+
+ Principianti: Usa "Fermate" - configura prima di avviare
+ Intermedi: Usa "In Pausa" - monitora senza puntare
+ Avanzati: Usa "Ricorda Stato" se configurato
+
+
+
+
+
+
+ Salva Comportamento Avvio
+
+
+
+
+
@@ -151,6 +269,7 @@
+
- Salva Impostazioni
+ Salva Limiti Log
@@ -191,22 +319,6 @@
max-width: 1200px;
margin: 0 auto;
}
-
- .card {
- border: none;
- border-radius: 12px;
- overflow: hidden;
- }
-
- .card-header {
- font-weight: 600;
- padding: 1.25rem;
- border-bottom: 2px solid rgba(255, 255, 255, 0.2);
- }
-
- .card-body {
- padding: 1.5rem;
- }
@code {
@@ -224,7 +336,6 @@
LoadSession();
LoadSettings();
- // Auto-refresh dati utente ogni 30 secondi
updateTimer = new System.Threading.Timer(async _ =>
{
if (!string.IsNullOrEmpty(currentUsername))
@@ -237,7 +348,6 @@
private void LoadSession()
{
- // Carica sessione salvata
var savedSession = AutoBidder.Services.SessionManager.LoadSession();
if (savedSession != null && savedSession.IsValid)
{
@@ -245,7 +355,6 @@
remainingBids = savedSession.RemainingBids;
cookieInput = savedSession.CookieString ?? "";
- // Inizializza il monitor con la sessione
if (!string.IsNullOrEmpty(savedSession.CookieString))
{
AuctionMonitor.InitializeSessionWithCookie(savedSession.CookieString, savedSession.Username ?? "");
@@ -253,7 +362,6 @@
}
else
{
- // Prova a caricare da AuctionMonitor
var session = AuctionMonitor.GetSession();
currentUsername = session?.Username;
remainingBids = session?.RemainingBids ?? 0;
@@ -283,7 +391,6 @@
var session = AuctionMonitor.GetSession();
if (session != null && !string.IsNullOrEmpty(session.Username))
{
- // Salva la sessione
AutoBidder.Services.SessionManager.SaveSession(session);
LoadSession();
@@ -291,21 +398,21 @@
usernameInput = "";
connectionError = null;
- await JSRuntime.InvokeVoidAsync("alert", $"? Connesso con successo come {session.Username}!");
+ await JSRuntime.InvokeVoidAsync("alert", $"? Connesso come {session.Username}!");
}
else
{
- connectionError = "Sessione creata ma dati utente non disponibili. Verifica il cookie.";
+ connectionError = "Sessione creata ma dati utente non disponibili.";
}
}
else
{
- connectionError = "Impossibile connettersi. Verifica che il cookie sia corretto e non scaduto.";
+ connectionError = "Impossibile connettersi. Verifica il cookie.";
}
}
catch (Exception ex)
{
- connectionError = $"Errore durante la connessione: {ex.Message}";
+ connectionError = $"Errore: {ex.Message}";
}
finally
{
@@ -334,16 +441,11 @@
{
currentUsername = session.Username;
remainingBids = session.RemainingBids;
-
- // Aggiorna sessione salvata
AutoBidder.Services.SessionManager.SaveSession(session);
}
}
}
- catch
- {
- // Ignora errori di refresh silenziosamente
- }
+ catch { }
}
private void SaveSettings()
@@ -351,6 +453,26 @@
AutoBidder.Utilities.SettingsManager.Save(settings);
_ = JSRuntime.InvokeVoidAsync("alert", "? Impostazioni salvate con successo!");
}
+
+ private void SetRememberState(bool remember)
+ {
+ settings.RememberAuctionStates = remember;
+ if (remember)
+ {
+ settings.DefaultStartAuctionsOnLoad = "Stopped";
+ }
+ }
+
+ private void SetLoadState(string state)
+ {
+ settings.RememberAuctionStates = false;
+ settings.DefaultStartAuctionsOnLoad = state;
+ }
+
+ private void SetNewAuctionState(string state)
+ {
+ settings.DefaultNewAuctionState = state;
+ }
private string GetRemainingBidsClass()
{
@@ -364,5 +486,3 @@
updateTimer?.Dispose();
}
}
-
-@implements IDisposable
diff --git a/Mimante/Pages/Statistics.razor b/Mimante/Pages/Statistics.razor
index bef6c9e..2da3477 100644
--- a/Mimante/Pages/Statistics.razor
+++ b/Mimante/Pages/Statistics.razor
@@ -172,7 +172,16 @@
protected override async Task OnInitializedAsync()
{
- await RefreshStats();
+ try
+ {
+ await RefreshStats();
+ }
+ catch (Exception ex)
+ {
+ errorMessage = $"Errore inizializzazione: {ex.Message}";
+ stats = new List
();
+ Console.WriteLine($"[ERROR] Statistics OnInitializedAsync: {ex}");
+ }
}
private async Task RefreshStats()
@@ -183,13 +192,27 @@
errorMessage = null;
StateHasChanged();
+ // Tentativo caricamento con timeout
+ var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
stats = await StatsService.GetAllStatsAsync();
+
+ if (stats == null)
+ {
+ stats = new List();
+ errorMessage = "Nessuna statistica disponibile. Il database potrebbe non essere inizializzato.";
+ }
+ }
+ catch (TaskCanceledException)
+ {
+ errorMessage = "Timeout durante caricamento statistiche. Riprova più tardi.";
+ stats = new List();
}
catch (Exception ex)
{
errorMessage = $"Si è verificato un errore: {ex.Message}";
stats = new List();
- Console.WriteLine($"[ERROR] Statistics page: {ex}");
+ Console.WriteLine($"[ERROR] Statistics RefreshStats: {ex}");
+ Console.WriteLine($"[ERROR] Stack trace: {ex.StackTrace}");
}
finally
{
diff --git a/Mimante/Pages/_Host.cshtml b/Mimante/Pages/_Host.cshtml
index eb2eace..06ba84f 100644
--- a/Mimante/Pages/_Host.cshtml
+++ b/Mimante/Pages/_Host.cshtml
@@ -11,9 +11,8 @@
-
+
-
@@ -27,11 +26,10 @@
Si è verificato un errore non gestito. Consultare la console del browser per ulteriori informazioni.
Ricarica
- ??
+ ?
-