CommandsSampleExtension.cs 847 B

123456789101112131415161718192021222324
  1. using PixiEditor.Extensions.CommonApi.Commands;
  2. using PixiEditor.Extensions.Sdk;
  3. namespace Sample9_Commands;
  4. public class CommandsSampleExtension : PixiEditorExtension
  5. {
  6. /// <summary>
  7. /// This method is called when extension is loaded.
  8. /// All extensions are first loaded and then initialized. This method is called before <see cref="OnInitialized"/>.
  9. /// </summary>
  10. public override void OnLoaded()
  11. {
  12. }
  13. /// <summary>
  14. /// This method is called when extension is initialized. After this method is called, you can use Api property to access PixiEditor API.
  15. /// </summary>
  16. public override void OnInitialized()
  17. {
  18. var doc = Api.Documents.ImportFile("Resources/cs.png", true); // Open file from the extension resources
  19. doc?.Resize(128, 128); // Resizes whole document
  20. }
  21. }