Example #1
0
 internal static void NotifyDependencyRegistering(SchubertOptions options, DependencySetupEventArgs args)
 {
     if (DependencyRegistering != null)
     {
         DependencyRegistering(options, args);
     }
 }
Example #2
0
 internal static void NotifyEngineStarted(SchubertOptions options, IServiceProvider builder)
 {
     if (EngineStarted != null)
     {
         EngineStarted(options, builder);
         if (EngineStarted != null) //再次判断,因为可能在执行方法中使用 “-=” 操作手动移除事件订阅使得委托链再次为空。
         {
             //清除委托列表,防止资源无法被 GC 收集。
             foreach (var delegateItem in EngineStarted.GetInvocationList())
             {
                 EngineStarted -= (EngineStartedHandler)delegateItem;
             }
         }
     }
 }
Example #3
0
 internal static void NotifyShellInitialized(SchubertOptions options, ShellContext context)
 {
     if (ShellInitialized != null)
     {
         ShellInitialized(options, context);
         //清除委托列表,防止资源无法被 GC 收集。
         if (ShellInitialized != null) //再次判断,因为可能在事件订阅的方法中使用 “-=” 操作手动移除事件订阅使得委托链再次为空。
         {
             foreach (var delegateItem in ShellInitialized.GetInvocationList())
             {
                 ShellInitialized -= (ShellInitializedHandler)delegateItem;
             }
         }
     }
 }