|
@@ -69,24 +69,29 @@ namespace InABox.Core
|
|
|
|
|
|
protected virtual TPoster CreatePoster()
|
|
protected virtual TPoster CreatePoster()
|
|
{
|
|
{
|
|
- return (Activator.CreateInstance(PosterType!) as TPoster)!;
|
|
|
|
|
|
+ var poster = (Activator.CreateInstance(PosterType!) as TPoster)!;
|
|
|
|
+ poster.Settings = GetSettings();
|
|
|
|
+ return poster;
|
|
}
|
|
}
|
|
|
|
|
|
- protected static TSettings GetSettings()
|
|
|
|
|
|
+ private TSettings _settings;
|
|
|
|
+ protected TSettings GetSettings()
|
|
{
|
|
{
|
|
- return PosterUtils.LoadPosterSettings<TPostable, TSettings>();
|
|
|
|
|
|
+ _settings ??= PosterUtils.LoadPosterSettings<TPostable, TSettings>();
|
|
|
|
+ return _settings;
|
|
}
|
|
}
|
|
|
|
|
|
- protected static void SaveSettings(TSettings settings)
|
|
|
|
|
|
+ protected void SaveSettings(TSettings settings)
|
|
{
|
|
{
|
|
- PosterUtils.SavePosterSettings<TPostable, TSettings>(settings);
|
|
|
|
|
|
+ _settings = settings;
|
|
|
|
+ PosterUtils.SavePosterSettings<TPostable, TSettings>(_settings);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Returns the <see cref="TSettings.Script"/>, if <see cref="TSettings.ScriptEnabled"/> is <see langword="true"/>;
|
|
/// Returns the <see cref="TSettings.Script"/>, if <see cref="TSettings.ScriptEnabled"/> is <see langword="true"/>;
|
|
/// otherwise, returns <see langword="null"/>.
|
|
/// otherwise, returns <see langword="null"/>.
|
|
/// </summary>
|
|
/// </summary>
|
|
- protected static string? GetScript()
|
|
|
|
|
|
+ protected string? GetScript()
|
|
{
|
|
{
|
|
var settings = GetSettings();
|
|
var settings = GetSettings();
|
|
return settings.ScriptEnabled ? settings.Script : null;
|
|
return settings.ScriptEnabled ? settings.Script : null;
|
|
@@ -135,6 +140,12 @@ namespace InABox.Core
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // Add posted flags; if the columns is null, then we don't need to worry, because it will be loaded.
|
|
|
|
+ model.GetColumns<TPostable>()?.Add(x => x.PostedStatus)
|
|
|
|
+ .Add(x => x.Posted)
|
|
|
|
+ .Add(x => x.PostedNote);
|
|
|
|
+
|
|
model.LoadModel();
|
|
model.LoadModel();
|
|
|
|
|
|
var data = model.GetTable<TPostable>();
|
|
var data = model.GetTable<TPostable>();
|