From 6e17072629a54e714b4e2fd1fe18635a2db45a58 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Sat, 1 Feb 2025 11:57:41 +0100 Subject: [PATCH] Add Editor.cs --- PCK-Studio/Internal/Editor.cs | 25 +++++++++++++++++++++++++ PCK-Studio/PckStudio.csproj | 3 +++ 2 files changed, 28 insertions(+) create mode 100644 PCK-Studio/Internal/Editor.cs diff --git a/PCK-Studio/Internal/Editor.cs b/PCK-Studio/Internal/Editor.cs new file mode 100644 index 00000000..aeff9c97 --- /dev/null +++ b/PCK-Studio/Internal/Editor.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MetroFramework.Forms; +using PckStudio.Interfaces; + +namespace PckStudio.Internal +{ + public abstract class Editor : MetroForm where T : class + { + protected T EditorValue; + private readonly ISaveContext SaveContext; + + protected Editor(T value, ISaveContext saveContext) + { + _ = value ?? throw new ArgumentNullException(nameof(value)); + EditorValue = value; + SaveContext = saveContext; + } + + protected void Save() => SaveContext.Save(EditorValue); + } +} \ No newline at end of file diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index fdd1122d..8002273e 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -164,6 +164,9 @@ + + Form +