コード例 #1
0
        private void InitializeCompositionContainer()
        {
            if (!Directory.Exists("Plugins"))
            {
                Directory.CreateDirectory("Plugins");
            }

            var catalog = new AggregatingComposablePartCatalog();

            catalog.Catalogs.Add(new DirectoryPartCatalog("Plugins", true));
            catalog.Catalogs.Add(new AttributedAssemblyPartCatalog(typeof(MonitorManager).Assembly));
            catalog.Catalogs.Add(new AttributedAssemblyPartCatalog(Assembly.GetExecutingAssembly()));

            container = new CompositionContainer(catalog.CreateResolver());

            container.AddPart(this);
            //container.AddExportedObject<ICompositionService>(container);
            //container.AddExportedObject<AggregatingComposablePartCatalog>(catalog);

            try
            {
                container.Compose();
            }
            catch (CompositionException compositionException)
            {
                MessageBox.Show(compositionException.ToString());
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Jiyuu/SkypeFX
        /// <summary>
        /// use managed extensibility framework to discover effects and load them into the main form
        /// </summary>
        private void Compose()
        {
            var catalog = new AggregatingComposablePartCatalog();
            var mainAssemblyCatalog = new AttributedAssemblyPartCatalog(this.GetType().Assembly);
            var jsNetCatalog = new AttributedAssemblyPartCatalog(typeof(Effect).Assembly);
            //var addInEffects = new DirectoryPartCatalog("Effects");

            catalog.Catalogs.Add(mainAssemblyCatalog);
            catalog.Catalogs.Add(jsNetCatalog);
            //catalog.Catalogs.Add(addInEffects);
            var container = new CompositionContainer(catalog);

            container.AddPart(this);
            container.Compose();
        }
コード例 #3
0
        /// <summary>
        /// use managed extensibility framework to discover effects and load them into the main form
        /// </summary>
        private void Compose()
        {
            var catalog             = new AggregatingComposablePartCatalog();
            var mainAssemblyCatalog = new AttributedAssemblyPartCatalog(this.GetType().Assembly);
            var jsNetCatalog        = new AttributedAssemblyPartCatalog(typeof(Effect).Assembly);

            //var addInEffects = new DirectoryPartCatalog("Effects");

            catalog.Catalogs.Add(mainAssemblyCatalog);
            catalog.Catalogs.Add(jsNetCatalog);
            //catalog.Catalogs.Add(addInEffects);
            var container = new CompositionContainer(catalog);

            container.AddPart(this);
            container.Compose();
        }
コード例 #4
0
ファイル: HelloProgram.cs プロジェクト: ledgarl/Samples
        public HelloProgram()
        {
            this.Services = new List<IHelloService>();

            if (!Directory.Exists("PlugIns"))
            {
                Directory.CreateDirectory("PlugIns");
            }

            AggregatingComposablePartCatalog catalog = new AggregatingComposablePartCatalog();
            catalog.Catalogs.Add(new AttributedAssemblyPartCatalog(Assembly.GetExecutingAssembly()));
            catalog.Catalogs.Add(new DirectoryPartCatalog("PlugIns"));
            
            CompositionContainer container = new CompositionContainer(catalog.CreateResolver());
            container.AddPart(this);
            container.Compose();
        }
コード例 #5
0
        public HelloProgram()
        {
            this.Services = new List <IHelloService>();

            if (!Directory.Exists("PlugIns"))
            {
                Directory.CreateDirectory("PlugIns");
            }

            AggregatingComposablePartCatalog catalog = new AggregatingComposablePartCatalog();

            catalog.Catalogs.Add(new AttributedAssemblyPartCatalog(Assembly.GetExecutingAssembly()));
            catalog.Catalogs.Add(new DirectoryPartCatalog("PlugIns"));

            CompositionContainer container = new CompositionContainer(catalog.CreateResolver());

            container.AddPart(this);
            container.Compose();
        }