2019-11-14 05:28:27 +00:00
|
|
|
|
using Microsoft.WindowsAPICodePack.Dialogs;
|
|
|
|
|
using ReactiveUI.Fody.Helpers;
|
|
|
|
|
using Wabbajack.Lib;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
|
|
|
|
public class ModlistSettingsEditorVM : ViewModel
|
|
|
|
|
{
|
2019-11-21 15:45:00 +00:00
|
|
|
|
private CompilationModlistSettings _settings;
|
2019-11-14 05:28:27 +00:00
|
|
|
|
|
|
|
|
|
[Reactive]
|
|
|
|
|
public string ModListName { get; set; }
|
|
|
|
|
|
|
|
|
|
[Reactive]
|
|
|
|
|
public string AuthorText { get; set; }
|
|
|
|
|
|
|
|
|
|
[Reactive]
|
|
|
|
|
public string Description { get; set; }
|
|
|
|
|
|
|
|
|
|
public FilePickerVM ImagePath { get; }
|
|
|
|
|
|
|
|
|
|
public FilePickerVM ReadMeText { get; }
|
|
|
|
|
|
|
|
|
|
[Reactive]
|
|
|
|
|
public string Website { get; set; }
|
|
|
|
|
|
2019-11-16 22:33:32 +00:00
|
|
|
|
public ModlistSettingsEditorVM(CompilationModlistSettings settings)
|
2019-11-14 05:28:27 +00:00
|
|
|
|
{
|
2019-11-21 15:45:00 +00:00
|
|
|
|
this._settings = settings;
|
2019-11-21 15:04:33 +00:00
|
|
|
|
ImagePath = new FilePickerVM()
|
2019-11-14 05:28:27 +00:00
|
|
|
|
{
|
2019-11-17 07:04:53 +00:00
|
|
|
|
ExistCheckOption = FilePickerVM.ExistCheckOptions.IfNotEmpty,
|
2019-11-14 05:28:27 +00:00
|
|
|
|
PathType = FilePickerVM.PathTypeOptions.File,
|
|
|
|
|
Filters =
|
|
|
|
|
{
|
|
|
|
|
new CommonFileDialogFilter("Banner image", "*.png")
|
|
|
|
|
}
|
|
|
|
|
};
|
2019-11-21 15:04:33 +00:00
|
|
|
|
ReadMeText = new FilePickerVM()
|
2019-11-14 05:28:27 +00:00
|
|
|
|
{
|
|
|
|
|
PathType = FilePickerVM.PathTypeOptions.File,
|
2019-11-17 07:04:53 +00:00
|
|
|
|
ExistCheckOption = FilePickerVM.ExistCheckOptions.IfNotEmpty,
|
2019-11-14 05:28:27 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
|
{
|
2019-11-21 15:45:00 +00:00
|
|
|
|
AuthorText = _settings.Author;
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(_settings.ModListName))
|
2019-11-14 05:28:27 +00:00
|
|
|
|
{
|
2019-11-21 15:45:00 +00:00
|
|
|
|
ModListName = _settings.ModListName;
|
2019-11-14 05:28:27 +00:00
|
|
|
|
}
|
2019-11-21 15:45:00 +00:00
|
|
|
|
Description = _settings.Description;
|
|
|
|
|
ReadMeText.TargetPath = _settings.Readme;
|
|
|
|
|
ImagePath.TargetPath = _settings.SplashScreen;
|
|
|
|
|
Website = _settings.Website;
|
2019-11-14 05:28:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Save()
|
|
|
|
|
{
|
2019-11-21 15:45:00 +00:00
|
|
|
|
_settings.Author = AuthorText;
|
|
|
|
|
_settings.ModListName = ModListName;
|
|
|
|
|
_settings.Description = Description;
|
|
|
|
|
_settings.Readme = ReadMeText.TargetPath;
|
|
|
|
|
_settings.SplashScreen = ImagePath.TargetPath;
|
|
|
|
|
_settings.Website = Website;
|
2019-11-14 05:28:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|