| 
152
 | 
     1 using System;
 | 
| 
 | 
     2 using System.Collections.Generic;
 | 
| 
 | 
     3 
 | 
| 
 | 
     4 namespace Implab.Components {
 | 
| 
 | 
     5     /// <summary>
 | 
| 
 | 
     6     /// Global application components and services.
 | 
| 
 | 
     7     /// </summary>
 | 
| 
 | 
     8     public static class App {
 | 
| 
 | 
     9         readonly static ComponentContainer<object> _root = new ComponentContainer<object>();
 | 
| 
 | 
    10 
 | 
| 
153
 | 
    11         /// <summary>
 | 
| 
 | 
    12         /// The container for application level components.
 | 
| 
 | 
    13         /// </summary>
 | 
| 
 | 
    14         /// <remarks>Pools of disposable objects can be placed here and they will be automatically
 | 
| 
 | 
    15         /// disposed when application domain is unloaded.</remarks>
 | 
| 
152
 | 
    16         public static ICollection<object> RootContainer {
 | 
| 
 | 
    17             get { return _root; }
 | 
| 
 | 
    18         }
 | 
| 
 | 
    19 
 | 
| 
 | 
    20         static App() {
 | 
| 
153
 | 
    21             AppDomain.CurrentDomain.DomainUnload += (sender, e) => _root.Dispose();
 | 
| 
152
 | 
    22         }
 | 
| 
 | 
    23     }
 | 
| 
 | 
    24 }
 | 
| 
 | 
    25 
 |