فهرست منبع

Fixed ad hoc extension events not firing

Krzysztof Krysiński 1 هفته پیش
والد
کامیت
bae2b87b58
2فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 9 0
      src/PixiEditor/ViewModels/SubViewModels/ExtensionsViewModel.cs
  2. 3 0
      src/PixiEditor/ViewModels/ViewModelMain.cs

+ 9 - 0
src/PixiEditor/ViewModels/SubViewModels/ExtensionsViewModel.cs

@@ -63,6 +63,15 @@ internal class ExtensionsViewModel : SubViewModel<ViewModelMain>
             ILocalizationProvider.Current.LoadExtensionData(loadedExtension.Metadata.Localization?.Languages,
                 loadedExtension.Location);
             loadedExtension.Initialize(new ExtensionServices(Owner.Services));
+            if (Owner.AttachedWindow != null && Owner.AttachedWindow.IsLoaded)
+            {
+                loadedExtension.MainWindowLoaded();
+            }
+
+            if (Owner.IsUserReady)
+            {
+                loadedExtension.UserReady();
+            }
         }
     }
 

+ 3 - 0
src/PixiEditor/ViewModels/ViewModelMain.cs

@@ -96,6 +96,8 @@ internal partial class ViewModelMain : ViewModelBase, ICommandsHandler
     public bool UserWantsToClose { get; private set; }
     public Guid CurrentSessionId { get; } = Guid.NewGuid();
     public DateTime LaunchDateTime { get; } = DateTime.Now;
+
+    public bool IsUserReady { get; set; } = false;
     public event Action OnUserReady;
 
     public event Action<DocumentViewModel> BeforeDocumentClosed;
@@ -415,6 +417,7 @@ internal partial class ViewModelMain : ViewModelBase, ICommandsHandler
 
     internal void InvokeUserReadyEvent()
     {
+        IsUserReady = true;
         OnUserReady?.Invoke();
     }
 }