2 using System.ComponentModel.Composition.Hosting;
3 using System.Diagnostics;
6 using System.Reflection;
7 using System.ComponentModel.Composition;
10 namespace Pithos.Client
14 public CompositionContainer Container;
16 static readonly Lazy<IoC> Instance=new Lazy<IoC>();
18 public static IoC Current
20 get { return Instance.Value; }
25 var catalog = new AggregateCatalog();
26 var executingAssembly = Assembly.GetExecutingAssembly();
27 catalog.Catalogs.Add(new AssemblyCatalog(executingAssembly));
29 Type[] types = {typeof (PithosMonitor), typeof (Pithos.Network.CloudFilesClient)};
30 foreach (var type in types)
32 catalog.Catalogs.Add(new AssemblyCatalog(type.Assembly));
37 Container=new CompositionContainer(catalog);
42 public T Compose<T>(T target)
46 Container.ComposeParts(target);
51 Trace.TraceError(exc.ToString());