2019-11-14 05:28:27 +00:00
|
|
|
|
using Microsoft.WindowsAPICodePack.Dialogs;
|
|
|
|
|
using ReactiveUI;
|
|
|
|
|
using ReactiveUI.Fody.Helpers;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using Wabbajack.Lib;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
|
|
|
|
public class ModlistSettingsEditorVM : ViewModel
|
|
|
|
|
{
|
|
|
|
|
private CompilationModlistSettings settings;
|
|
|
|
|
|
|
|
|
|
[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
|
|
|
|
{
|
|
|
|
|
this.settings = settings;
|
|
|
|
|
this.ImagePath = new FilePickerVM()
|
|
|
|
|
{
|
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")
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
this.ReadMeText = new FilePickerVM()
|
|
|
|
|
{
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
this.AuthorText = settings.Author;
|
2019-11-16 22:33:32 +00:00
|
|
|
|
if (!string.IsNullOrWhiteSpace(settings.ModListName))
|
2019-11-14 05:28:27 +00:00
|
|
|
|
{
|
|
|
|
|
this.ModListName = settings.ModListName;
|
|
|
|
|
}
|
|
|
|
|
this.Description = settings.Description;
|
|
|
|
|
this.ReadMeText.TargetPath = settings.Readme;
|
|
|
|
|
this.ImagePath.TargetPath = settings.SplashScreen;
|
|
|
|
|
this.Website = settings.Website;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Save()
|
|
|
|
|
{
|
|
|
|
|
settings.Author = this.AuthorText;
|
|
|
|
|
settings.ModListName = this.ModListName;
|
|
|
|
|
settings.Description = this.Description;
|
|
|
|
|
settings.Readme = this.ReadMeText.TargetPath;
|
|
|
|
|
settings.SplashScreen = this.ImagePath.TargetPath;
|
|
|
|
|
settings.Website = this.Website;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|