diff --git a/PCK-Studio/Interfaces/ISaveContext.cs b/PCK-Studio/Interfaces/ISaveContext.cs new file mode 100644 index 00000000..3abbddba --- /dev/null +++ b/PCK-Studio/Interfaces/ISaveContext.cs @@ -0,0 +1,25 @@ +using System; + +namespace PckStudio.Interfaces +{ + public interface ISaveContext + { + public bool AutoSave { get; } + + public void Save(T value); + } + + public sealed class DelegatedSaveContext : ISaveContext + { + private readonly Action _saveAction; + public bool AutoSave { get; } + + public void Save(T value) => _saveAction(value); + + public DelegatedSaveContext(bool autoSave, Action saveAction) + { + AutoSave = autoSave; + _saveAction = saveAction; + } + } +} \ No newline at end of file diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index 0aa9ac3a..fdd1122d 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -154,6 +154,7 @@ ContributorsForm.cs + Form