|
@@ -1,4 +1,6 @@
|
|
-using System.Runtime.CompilerServices;
|
|
|
|
|
|
+using System.Diagnostics;
|
|
|
|
+using System.Reflection;
|
|
|
|
+using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
namespace PixiEditor.Extensions.Wasm;
|
|
namespace PixiEditor.Extensions.Wasm;
|
|
@@ -11,8 +13,22 @@ internal class Interop
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
internal static extern void CreatePopupWindow(string title, string body);
|
|
internal static extern void CreatePopupWindow(string title, string body);
|
|
|
|
|
|
|
|
+ internal static void Load()
|
|
|
|
+ {
|
|
|
|
+ Type extensionType = Assembly.GetEntryAssembly().ExportedTypes
|
|
|
|
+ .FirstOrDefault(type => type.IsSubclassOf(typeof(WasmExtension)));
|
|
|
|
+
|
|
|
|
+ Debug.Assert(extensionType != null, "extensionType != null");
|
|
|
|
+
|
|
|
|
+ LogMessage($"Loading extension {extensionType.FullName}");
|
|
|
|
+
|
|
|
|
+ WasmExtension extension = (WasmExtension)Activator.CreateInstance(extensionType);
|
|
|
|
+ ExtensionContext.Active = extension;
|
|
|
|
+ extension.OnLoaded();
|
|
|
|
+ }
|
|
|
|
+
|
|
internal static void Initialize()
|
|
internal static void Initialize()
|
|
{
|
|
{
|
|
- ExtensionEvents.Initialize();
|
|
|
|
|
|
+ ExtensionContext.Active.OnInitialized();
|
|
}
|
|
}
|
|
}
|
|
}
|