move SheepIt settings to global settings
This commit is contained in:
45
ViewModels/GlobalSettingsViewModel.cs
Normal file
45
ViewModels/GlobalSettingsViewModel.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,6 @@ namespace UnifiedFarmLauncher.ViewModels
|
||||
private int _sshPort = 22;
|
||||
private string _sshArgs = string.Empty;
|
||||
private string _sheepItGpu = "OPTIX_0";
|
||||
private string _sheepItUsername = string.Empty;
|
||||
private string _sheepItRenderKey = string.Empty;
|
||||
private string _flamencoWorkerPath = string.Empty;
|
||||
private bool _hasSheepIt;
|
||||
private bool _hasFlamenco;
|
||||
@@ -93,18 +91,6 @@ namespace UnifiedFarmLauncher.ViewModels
|
||||
set => SetAndRaise(ref _sheepItGpu, value);
|
||||
}
|
||||
|
||||
public string SheepItUsername
|
||||
{
|
||||
get => _sheepItUsername;
|
||||
set => SetAndRaise(ref _sheepItUsername, value);
|
||||
}
|
||||
|
||||
public string SheepItRenderKey
|
||||
{
|
||||
get => _sheepItRenderKey;
|
||||
set => SetAndRaise(ref _sheepItRenderKey, value);
|
||||
}
|
||||
|
||||
public string FlamencoWorkerPath
|
||||
{
|
||||
get => _flamencoWorkerPath;
|
||||
@@ -127,8 +113,6 @@ namespace UnifiedFarmLauncher.ViewModels
|
||||
{
|
||||
HasSheepIt = true;
|
||||
SheepItGpu = worker.WorkerTypes.SheepIt.Gpu;
|
||||
SheepItUsername = worker.WorkerTypes.SheepIt.Username;
|
||||
SheepItRenderKey = worker.WorkerTypes.SheepIt.RenderKey;
|
||||
}
|
||||
|
||||
if (worker.WorkerTypes.Flamenco != null)
|
||||
@@ -168,9 +152,7 @@ namespace UnifiedFarmLauncher.ViewModels
|
||||
{
|
||||
worker.WorkerTypes.SheepIt = new SheepItConfig
|
||||
{
|
||||
Gpu = SheepItGpu,
|
||||
Username = SheepItUsername,
|
||||
RenderKey = SheepItRenderKey
|
||||
Gpu = SheepItGpu
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user