Jelajahi Sumber

Samples changes

flabbet 1 tahun lalu
induk
melakukan
dfd6c9d11c

+ 9 - 3
samples/PixiEditorExtensionSamples.sln

@@ -5,14 +5,16 @@ VisualStudioVersion = 17.0.31903.59
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PixiEditor.Extensions.Wasm", "..\src\PixiEditor.Extensions.Wasm\PixiEditor.Extensions.Wasm.csproj", "{FD9B4C32-4D2E-410E-BC6B-787779BEB6E2}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{82A85041-A666-42DB-8F84-7D91EF9A5C9D}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample1_HelloWorld", "Sample1_HelloWorld\Sample1_HelloWorld.csproj", "{82A85041-A666-42DB-8F84-7D91EF9A5C9D}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalizationSample", "LocalizationSample\LocalizationSample.csproj", "{3201A287-5103-48F1-9005-E27B5025E6FA}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample2_LocalizationSample", "Sample2_LocalizationSample\Sample2_LocalizationSample.csproj", "{3201A287-5103-48F1-9005-E27B5025E6FA}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Preferences", "Preferences\Preferences.csproj", "{EF6E6827-9827-4465-AD9B-5BE6BEE5747D}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample3_Preferences", "Sample3_Preferences\Sample3_Preferences.csproj", "{EF6E6827-9827-4465-AD9B-5BE6BEE5747D}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_References", "_References", "{7CC35BC4-829F-4EF4-8EB6-E1D46206E7DC}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample4_CreatePopup", "Sample4_CreatePopup\Sample4_CreatePopup.csproj", "{93ADCE51-F671-4374-84AC-5AB07A098F27}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -38,6 +40,10 @@ Global
 		{EF6E6827-9827-4465-AD9B-5BE6BEE5747D}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{EF6E6827-9827-4465-AD9B-5BE6BEE5747D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{EF6E6827-9827-4465-AD9B-5BE6BEE5747D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{93ADCE51-F671-4374-84AC-5AB07A098F27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{93ADCE51-F671-4374-84AC-5AB07A098F27}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{93ADCE51-F671-4374-84AC-5AB07A098F27}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{93ADCE51-F671-4374-84AC-5AB07A098F27}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
 		{FD9B4C32-4D2E-410E-BC6B-787779BEB6E2} = {7CC35BC4-829F-4EF4-8EB6-E1D46206E7DC}

+ 0 - 0
samples/HelloWorld/HelloWorldExtension.cs → samples/Sample1_HelloWorld/HelloWorldExtension.cs


+ 0 - 0
samples/HelloWorld/Program.cs → samples/Sample1_HelloWorld/Program.cs


+ 1 - 0
samples/HelloWorld/HelloWorld.csproj → samples/Sample1_HelloWorld/Sample1_HelloWorld.csproj

@@ -8,6 +8,7 @@
         <GenerateExtensionPackage>true</GenerateExtensionPackage>
         <PixiExtOutputPath>..\..\src\PixiEditor.AvaloniaUI.Desktop\bin\Debug\net8.0\win-x64\Extensions</PixiExtOutputPath>
         <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+        <RootNamespace>HelloWorld</RootNamespace>
     </PropertyGroup>
     
     <ItemGroup>

+ 0 - 0
samples/HelloWorld/extension.json → samples/Sample1_HelloWorld/extension.json


+ 0 - 0
samples/LocalizationSample/Localization/en.json → samples/Sample2_LocalizationSample/Localization/en.json


+ 0 - 0
samples/LocalizationSample/LocalizationSampleExtension.cs → samples/Sample2_LocalizationSample/LocalizationSampleExtension.cs


+ 0 - 0
samples/LocalizationSample/Program.cs → samples/Sample2_LocalizationSample/Program.cs


+ 0 - 0
samples/LocalizationSample/README.md → samples/Sample2_LocalizationSample/README.md


+ 1 - 0
samples/LocalizationSample/LocalizationSample.csproj → samples/Sample2_LocalizationSample/Sample2_LocalizationSample.csproj

@@ -8,6 +8,7 @@
         <GenerateExtensionPackage>true</GenerateExtensionPackage>
         <PixiExtOutputPath>..\..\src\PixiEditor.AvaloniaUI.Desktop\bin\Debug\net8.0\win-x64\Extensions</PixiExtOutputPath>
         <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+        <RootNamespace>LocalizationSample</RootNamespace>
     </PropertyGroup>
 
     <ItemGroup>

+ 0 - 0
samples/LocalizationSample/extension.json → samples/Sample2_LocalizationSample/extension.json


+ 0 - 0
samples/Preferences/PreferencesSampleExtension.cs → samples/Sample3_Preferences/PreferencesSampleExtension.cs


+ 1 - 1
samples/Preferences/Program.cs → samples/Sample3_Preferences/Program.cs

@@ -5,7 +5,7 @@ public static class Program
     /// <summary>
     ///     The entry point of the application. This will be executed when extension is loaded.
     /// You can use this method, but there are special methods that are used for initialization. You won't be able to access PixiEditor Api at this point.
-    /// See <see cref="LocalizationSampleExtension"/> for more information.
+    /// See <see cref="PreferencesSampleExtension"/> for more information.
     /// </summary>
     public static void Main()
     {

+ 0 - 0
samples/Preferences/README.md → samples/Sample3_Preferences/README.md


+ 1 - 0
samples/Preferences/Preferences.csproj → samples/Sample3_Preferences/Sample3_Preferences.csproj

@@ -8,6 +8,7 @@
         <GenerateExtensionPackage>true</GenerateExtensionPackage>
         <PixiExtOutputPath>..\..\src\PixiEditor.AvaloniaUI.Desktop\bin\Debug\net8.0\win-x64\Extensions</PixiExtOutputPath>
         <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+        <RootNamespace>Preferences</RootNamespace>
     </PropertyGroup>
 
     <ItemGroup>

+ 0 - 0
samples/Preferences/extension.json → samples/Sample3_Preferences/extension.json


+ 26 - 0
samples/Sample4_CreatePopup/CreatePopupSampleExtension.cs

@@ -0,0 +1,26 @@
+using PixiEditor.Extensions.Wasm;
+using PixiEditor.Extensions.Wasm.Api.FlyUI;
+
+namespace CreatePopupSample;
+
+public class CreatePopupSampleExtension : WasmExtension
+{
+    /// <summary>
+    ///     This method is called when extension is loaded.
+    ///  All extensions are first loaded and then initialized. This method is called before <see cref="OnInitialized"/>.
+    /// </summary>
+    public override void OnLoaded()
+    {
+
+    }
+
+    /// <summary>
+    ///     This method is called when extension is initialized. After this method is called, you can use Api property to access PixiEditor API.
+    /// </summary>
+    public override async void OnInitialized()
+    {
+        var popup = Api.WindowProvider.CreatePopupWindow("Hello World", new Text("Hello from popup!"));
+        await popup.ShowDialog().;
+        Api.Logger.Log("Popup closed");
+    }
+}

+ 14 - 0
samples/Sample4_CreatePopup/Program.cs

@@ -0,0 +1,14 @@
+namespace CreatePopupSample;
+
+public static class Program
+{
+    /// <summary>
+    ///     The entry point of the application. This will be executed when extension is loaded.
+    /// You can use this method, but there are special methods that are used for initialization. You won't be able to access PixiEditor Api at this point.
+    /// See <see cref="CreatePopupSampleExtension"/> for more information.
+    /// </summary>
+    public static void Main()
+    {
+
+    }
+}

+ 0 - 0
samples/Sample4_CreatePopup/README.md


+ 36 - 0
samples/Sample4_CreatePopup/Sample4_CreatePopup.csproj

@@ -0,0 +1,36 @@
+<Project Sdk="Microsoft.NET.Sdk">
+    <PropertyGroup>
+        <TargetFramework>net8.0</TargetFramework>
+        <RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>
+        <OutputType>Exe</OutputType>
+        <PublishTrimmed>true</PublishTrimmed>
+        <WasmSingleFileBundle>true</WasmSingleFileBundle>
+        <GenerateExtensionPackage>true</GenerateExtensionPackage>
+        <PixiExtOutputPath>..\..\src\PixiEditor.AvaloniaUI.Desktop\bin\Debug\net8.0\win-x64\Extensions</PixiExtOutputPath>
+        <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+        <RootNamespace>CreatePopupSample</RootNamespace>
+    </PropertyGroup>
+
+    <ItemGroup>
+        <None Remove="extension.json" />
+        <Content Include="extension.json">
+            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+        </Content>
+    </ItemGroup>
+
+    <ItemGroup>
+        <Content Include="Localization\*">
+            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+        </Content>
+    </ItemGroup>
+
+    <!--Below is not required if you use Nuget package, this sample references project directly, so it must be here-->
+    <ItemGroup>
+        <ProjectReference Include="..\..\src\PixiEditor.Extensions.Wasm\PixiEditor.Extensions.Wasm.csproj" />
+    </ItemGroup>
+
+    <!--Below is not required if you use Nuget package, this sample references project directly, so it must be here-->
+    <Import Project="..\..\src\PixiEditor.Extensions.Wasm\build\PixiEditor.Extensions.Wasm.props"/>
+    <Import Project="..\..\src\PixiEditor.Extensions.Wasm\build\PixiEditor.Extensions.Wasm.targets" />
+
+</Project>

+ 27 - 0
samples/Sample4_CreatePopup/extension.json

@@ -0,0 +1,27 @@
+{
+  "displayName": "Sample Extension - Create Popup",
+  "uniqueName": "yourCompany.Samples.CreatePopup",
+  "description": "Sample localization extension for PixiEditor",
+  "version": "1.0.0",
+  "author": {
+    "name": "PixiEditor",
+    "email": "[email protected]",
+    "website": "https://pixieditor.net"
+  },
+  "publisher": {
+    "name": "PixiEditor",
+    "email": "[email protected]",
+    "website": "https://pixieditor.net"
+  },
+  "contributors": [
+    {
+      "name": "flabbet",
+      "email": "[email protected]",
+      "website": "https://github.com/flabbet"
+    }
+  ],
+  "license": "MIT",
+  "categories": [
+    "Extension"
+  ]
+}