68 lines
2.4 KiB
C#
68 lines
2.4 KiB
C#
using System.Windows.Input;
|
|
using DesktopBot.Models;
|
|
|
|
namespace DesktopBot.ViewModels
|
|
{
|
|
/// <summary>
|
|
/// ViewModel per la configurazione dei limiti di logging.
|
|
/// </summary>
|
|
public class LoggingSettingsViewModel : BaseViewModel
|
|
{
|
|
private LoggingConfiguration _config;
|
|
|
|
public LoggingSettingsViewModel(LoggingConfiguration config)
|
|
{
|
|
_config = config?.Clone() ?? new LoggingConfiguration();
|
|
}
|
|
|
|
/// <summary>Numero massimo di elementi nel log del bot.</summary>
|
|
public int MaxBotLogEntries
|
|
{
|
|
get => _config.MaxBotLogEntries;
|
|
set { _config.MaxBotLogEntries = value; OnPropertyChanged(); }
|
|
}
|
|
|
|
/// <summary>Numero massimo di elementi nello storico trade.</summary>
|
|
public int MaxTradeHistoryEntries
|
|
{
|
|
get => _config.MaxTradeHistoryEntries;
|
|
set { _config.MaxTradeHistoryEntries = value; OnPropertyChanged(); }
|
|
}
|
|
|
|
/// <summary>Numero massimo di elementi nel log attività della dashboard.</summary>
|
|
public int MaxActivityLogEntries
|
|
{
|
|
get => _config.MaxActivityLogEntries;
|
|
set { _config.MaxActivityLogEntries = value; OnPropertyChanged(); }
|
|
}
|
|
|
|
/// <summary>Numero massimo di elementi nel log live globale.</summary>
|
|
public int MaxLiveLogEntries
|
|
{
|
|
get => _config.MaxLiveLogEntries;
|
|
set { _config.MaxLiveLogEntries = value; OnPropertyChanged(); }
|
|
}
|
|
|
|
/// <summary>Numero massimo di punti dati nel grafico dei prezzi.</summary>
|
|
public int MaxPriceDataPoints
|
|
{
|
|
get => _config.MaxPriceDataPoints;
|
|
set { _config.MaxPriceDataPoints = value; OnPropertyChanged(); }
|
|
}
|
|
|
|
/// <summary>Restituisce la configurazione modificata.</summary>
|
|
public LoggingConfiguration GetUpdatedConfig() => _config.Clone();
|
|
|
|
/// <summary>Ripristina i valori di default.</summary>
|
|
public void ResetToDefaults()
|
|
{
|
|
var defaults = new LoggingConfiguration();
|
|
MaxBotLogEntries = defaults.MaxBotLogEntries;
|
|
MaxTradeHistoryEntries = defaults.MaxTradeHistoryEntries;
|
|
MaxActivityLogEntries = defaults.MaxActivityLogEntries;
|
|
MaxLiveLogEntries = defaults.MaxLiveLogEntries;
|
|
MaxPriceDataPoints = defaults.MaxPriceDataPoints;
|
|
}
|
|
}
|
|
}
|