using System; using System.Threading.Tasks; using ThreadPilot.Models; namespace ThreadPilot.Services { /// /// Service for managing application settings /// public interface IApplicationSettingsService { /// /// Event fired when settings are changed /// event EventHandler? SettingsChanged; /// /// Gets the current application settings /// ApplicationSettingsModel Settings { get; } /// /// Loads settings from storage /// Task LoadSettingsAsync(); /// /// Saves current settings to storage /// Task SaveSettingsAsync(); /// /// Updates settings and saves them /// Task UpdateSettingsAsync(ApplicationSettingsModel newSettings); /// /// Resets settings to default values /// Task ResetToDefaultsAsync(); /// /// Gets the settings file path /// string GetSettingsFilePath(); /// /// Validates settings and fixes any invalid values /// void ValidateAndFixSettings(); /// /// Exports settings to a file /// Task ExportSettingsAsync(string filePath); /// /// Imports settings from a file /// Task ImportSettingsAsync(string filePath); } /// /// Event args for settings changed event /// public class ApplicationSettingsChangedEventArgs : EventArgs { public ApplicationSettingsModel OldSettings { get; } public ApplicationSettingsModel NewSettings { get; } public string[] ChangedProperties { get; } public ApplicationSettingsChangedEventArgs( ApplicationSettingsModel oldSettings, ApplicationSettingsModel newSettings, string[] changedProperties) { OldSettings = oldSettings; NewSettings = newSettings; ChangedProperties = changedProperties; } } }