move SheepIt settings to global settings

This commit is contained in:
Nathan
2025-12-17 16:19:08 -07:00
parent 03b3ae58f4
commit 202ad49f48
11 changed files with 268 additions and 34 deletions

View File

@@ -0,0 +1,45 @@
using UnifiedFarmLauncher.Models;
using UnifiedFarmLauncher.Services;
namespace UnifiedFarmLauncher.ViewModels
{
public class GlobalSettingsViewModel : ViewModelBase
{
private readonly ConfigService _configService;
private string _sheepItUsername = string.Empty;
private string _sheepItRenderKey = string.Empty;
public GlobalSettingsViewModel(ConfigService configService)
{
_configService = configService;
LoadSettings();
}
public string SheepItUsername
{
get => _sheepItUsername;
set => SetAndRaise(ref _sheepItUsername, value);
}
public string SheepItRenderKey
{
get => _sheepItRenderKey;
set => SetAndRaise(ref _sheepItRenderKey, value);
}
private void LoadSettings()
{
var config = _configService.Load();
SheepItUsername = config.GlobalSettings.SheepItUsername;
SheepItRenderKey = config.GlobalSettings.SheepItRenderKey;
}
public void Save()
{
var config = _configService.Load();
config.GlobalSettings.SheepItUsername = SheepItUsername;
config.GlobalSettings.SheepItRenderKey = SheepItRenderKey;
_configService.Save(config);
}
}
}