JD2022-TU1/main/tools/modules/JD.Guinness.WPF.Module/Model/Stadia/StadiaConfiguration.cs

78 lines
2.3 KiB
C#

using System.Linq;
using JD.Guinness.WPF.Module.Configuration.Stadia;
using JD.Guinness.WPF.Module.Extension;
using Plume.WPF.Mvvm;
namespace JD.Guinness.WPF.Module.Model.Stadia
{
public sealed class StadiaConfiguration : BindableBase, IWarnable
{
private bool _generate;
private bool _syncToStoreFront;
private bool _generateExcel;
private string _jsonFilePath;
private string _excelFilePath;
private string _iconsFolderPath;
private string _warnings;
public bool Generate
{
get => _generate;
set => SetProperty(ref _generate, value);
}
public bool SyncToStoreFront
{
get => _syncToStoreFront;
set => SetProperty(ref _syncToStoreFront, value);
}
public bool GenerateExcel
{
get => _generateExcel;
set => SetProperty(ref _generateExcel, value);
}
public string StoreFrontFilePath
{
get => _jsonFilePath;
set => SetProperty(ref _jsonFilePath, value);
}
public string ExcelFilePath
{
get => _excelFilePath;
set => SetProperty(ref _excelFilePath, value);
}
public string IconsFolderPath
{
get => _iconsFolderPath;
set => SetProperty(ref _iconsFolderPath, value);
}
public string Warnings
{
get => _warnings;
set => SetProperty(ref _warnings, value);
}
public DispatcherObservableCollection<Selectable<LanguageInfo>> Languages { get; }
public StadiaConfiguration()
{
Languages = new DispatcherObservableCollection<Selectable<LanguageInfo>>();
}
public StadiaConfigurationSave ToSave(string workspacePath) => new StadiaConfigurationSave
{
Generate = Generate,
StoreFrontFilePath = StoreFrontFilePath.ToRelativePath(workspacePath),
SyncToStoreFront = SyncToStoreFront,
ExcelFilePath = ExcelFilePath.ToRelativePath(workspacePath),
IconsFolderPath = IconsFolderPath.ToRelativePath(workspacePath),
GenerateExcel = GenerateExcel,
Languages = Languages.Where(s => s.IsSelected).Select(s => s.Value.Id).ToArray()
};
}
}