当前位置: 首页>>代码示例>>C#>>正文


C# ComposablePartCatalog类代码示例

本文整理汇总了C#中ComposablePartCatalog的典型用法代码示例。如果您正苦于以下问题:C# ComposablePartCatalog类的具体用法?C# ComposablePartCatalog怎么用?C# ComposablePartCatalog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ComposablePartCatalog类属于命名空间,在下文中一共展示了ComposablePartCatalog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NetworkAwareCatalog

        public NetworkAwareCatalog(ComposablePartCatalog filteredCatalog)
        {
            _networkStatus = (NetworkInterface.GetIsNetworkAvailable()) ? "Online" : "Offline";
            NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkAvailabilityChanged);

            _filteredCatalog = filteredCatalog;
        }
开发者ID:Helen1987,项目名称:edu,代码行数:7,代码来源:NetworkAwareCatalog.cs

示例2: FilteredCatalog

 public FilteredCatalog(ComposablePartCatalog inner,
                        Func<ComposablePartDefinition, bool> filter)
 {
     _inner = inner;
     _innerNotifyChange = inner as INotifyComposablePartCatalogChanged;
     _partsQuery = inner.Parts.Where(filter).AsQueryable();
 }
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CatalogFactory.FilteredComposablePartCatalog.cs

示例3: CompositionService

        internal CompositionService(ComposablePartCatalog composablePartCatalog)
        {
            Assumes.NotNull(composablePartCatalog);
            this._notifyCatalog = composablePartCatalog as INotifyComposablePartCatalogChanged;
            try
            {
                if(this._notifyCatalog != null)
                {
                    this._notifyCatalog.Changing += this.OnCatalogChanging;
                }

                var compositionOptions = CompositionOptions.DisableSilentRejection | CompositionOptions.IsThreadSafe | CompositionOptions.ExportCompositionService;
                var compositionContainer = new CompositionContainer(composablePartCatalog, compositionOptions);
    
                this._compositionContainer = compositionContainer;
            }
            catch
            {
                if(this._notifyCatalog != null)
                {
                    this._notifyCatalog.Changing -= this.OnCatalogChanging;
                }
                throw;
            }
        }
开发者ID:nlhepler,项目名称:mono,代码行数:25,代码来源:CompositionService.cs

示例4: CompositionScopeDefinition

        /// <summary>
        /// Initializes a new instance of the <see cref="CompositionScopeDefinition"/> class.
        /// </summary>
        /// <param name="catalog">The catalog.</param>
        /// <param name="children">The children.</param>
        public CompositionScopeDefinition(ComposablePartCatalog catalog, IEnumerable<CompositionScopeDefinition> children)
        {
            Requires.NotNull(catalog, "catalog");
            Requires.NullOrNotNullElements(children, "children");

            InitializeCompositionScopeDefinition(catalog, children, null);
        }
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:CompositionScopeDefinition.cs

示例5: GenericCatalog

 public GenericCatalog(ComposablePartCatalog catalog)
 {
     _decoratedCatalog = catalog;
     _catalog.Catalogs.Add(_decoratedCatalog);
     _catalog.Changing += (s, e) => { OnChanging(e); };
     LoadTypeLocators(_genericTypes);
 }
开发者ID:jbogard,项目名称:MefContrib,代码行数:7,代码来源:GenericCatalog.cs

示例6: MefUnityContainerExtension

 public MefUnityContainerExtension(ComposablePartCatalog catalog, bool register, params ExportProvider[] providers)
 {
     Debug.Assert(catalog != null);
     m_Catalog = catalog;
     m_Register = register;
     m_Providers = providers;
 }
开发者ID:pwlodek,项目名称:CodeGallery,代码行数:7,代码来源:MefUnityContainerExtension.cs

示例7: Document

        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="xml"></param>
        /// <param name="catalog"></param>
        /// <param name="exports"></param>
        Document(
            Func<Document, XDocument> xml,
            ComposablePartCatalog catalog,
            ExportProvider exports)
        {
            Contract.Requires<ArgumentNullException>(xml != null);

            // configure composition
            this.configuration = GetConfiguration(catalog, exports);
            this.container = new CompositionContainer(configuration.HostCatalog, true, new CompositionContainer(configuration.GlobalCatalog, true, configuration.Exports));
            this.container.GetExportedValue<DocumentEnvironment>().SetHost(this);

            // required services
            this.invoker = container.GetExportedValue<IInvoker>();
            this.trace = container.GetExportedValue<ITraceService>();

            // initialize xml
            this.xml = xml(this);
            this.xml.AddAnnotation(this);

            // parallel initialization of common interfaces
            Parallel.ForEach(this.xml.DescendantNodesAndSelf(), i =>
            {
                Enumerable.Empty<object>()
                    .Concat(i.Interfaces<IOnInit>())
                    .Concat(i.Interfaces<IOnLoad>())
                    .ToLinkedList();
            });

            // initial invocation entry
            this.invoker.Invoke(() => { });
        }
开发者ID:nxkit,项目名称:nxkit,代码行数:38,代码来源:Document.cs

示例8: TouchCatalog

        public static async Task TouchCatalog(ComposablePartCatalog composablePartCatalog)
        {
            var aggregate = composablePartCatalog as AggregateCatalog;
            if (aggregate != null)
            {
                //foreach (var catalog in aggregate.Catalogs)
                //{
                //    TouchCatalog(catalog);
                //}

                var actionList = new List<Task>();
                foreach (var item in aggregate.Catalogs)
                {
                    actionList.Add(TouchCatalog(item));
                }

                await Task.WhenAll(actionList.ToArray());
            }
            else
            {
                var metadataAssemblyCatalog = composablePartCatalog as MetadataAssemblyCatalog;
                if (metadataAssemblyCatalog != null)
                {
                    await metadataAssemblyCatalog.Realize();
                }

                foreach (var part in composablePartCatalog.Parts)
                {
                    TouchPart(part);
                }
            }
        }
开发者ID:KirillOsenkov,项目名称:MEFMetadata,代码行数:32,代码来源:CompositionDumper.cs

示例9: SelectParts

 public IQueryable<ComposablePart> SelectParts(ComposablePartCatalog catalog)
 {
     var parts = from part in catalog.Parts
                 where part.ExportDefinitions.Any(d => d.ContractName == typeof(IOperatorsPackage).FullName)
                 select part.CreatePart();
     return parts;
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:7,代码来源:MEFOperatorLoader.cs

示例10: FilteredCatalog

    /// <summary>
    /// Initializes a new instance of the FilteredCatalog class with the specified underlying
    /// catalog and filter.
    /// </summary>
    public FilteredCatalog(ComposablePartCatalog inner,
		Expression<Func<ComposablePartDefinition, bool>> expression)
    {
        _inner = inner;
        _innerNotifyChange = inner as INotifyComposablePartCatalogChanged;
        _partsQuery = inner.Parts.Where(expression);
    }
开发者ID:regnrand,项目名称:chorus,代码行数:11,代码来源:FilteredCatalog.cs

示例11: MEFedMVVMExportProvider

 public MEFedMVVMExportProvider(ComposablePartCatalog catalog)
 {
     _exportProvider = new CatalogExportProvider(catalog);
     //support recomposition
     _exportProvider.ExportsChanged += (s, e) => OnExportsChanged(e); 
     _exportProvider.ExportsChanging += (s, e) => OnExportsChanging(e);
 }
开发者ID:JoeGilkey,项目名称:RadioLog,代码行数:7,代码来源:MEFedMVVMExportProvider.cs

示例12: ScopeCatalog

        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="scope"></param>
        public ScopeCatalog(ComposablePartCatalog parent, Scope scope)
            : base(parent, GetFilter(scope))
        {
            Contract.Requires<ArgumentNullException>(parent != null);

            this.scope = scope;
        }
开发者ID:nxkit,项目名称:nxkit,代码行数:12,代码来源:ScopeCatalog.cs

示例13: ScopedContainerManager

        public ScopedContainerManager(ComposablePartCatalog rootCatalog)
        {
            if (rootCatalog == null) throw new ArgumentNullException("rootCatalog");

            _rootCatalog = rootCatalog;

            _container = new CompositionContainer(new FilteredCatalog(rootCatalog, def => GetAllWithinAppScope(def)), true);
        }
开发者ID:chrisortman,项目名称:Ketchup.Web,代码行数:8,代码来源:ScopedContainerManager.cs

示例14: RegisterCatalog

 /// <summary>
 /// Registers a MEF catalog within Unity container.
 /// </summary>
 /// <param name="unityContainer">Unity container instance.</param>
 /// <param name="catalog">MEF catalog to be registered.</param>
 /// <param name="isThreadSafe">Indicates if MEF should be thread safe.</param>
 public static void RegisterCatalog(this IUnityContainer unityContainer, ComposablePartCatalog catalog, bool isThreadSafe = false)
 {
     lock (unityContainer)
     {
         var compositionIntegration = EnableCompositionIntegration(unityContainer, isThreadSafe);
         compositionIntegration.Catalogs.Add(catalog);
     }
 }
开发者ID:doublekill,项目名称:MefContrib,代码行数:14,代码来源:UnityContainerExtensions.cs

示例15: CatalogChangeProxy

 public CatalogChangeProxy(ComposablePartCatalog originalCatalog,
     IEnumerable<ComposablePartDefinition> addedParts,
     IEnumerable<ComposablePartDefinition> removedParts)
 {
     this._originalCatalog = originalCatalog;
     this._addedParts = new List<ComposablePartDefinition>(addedParts);
     this._removedParts = new HashSet<ComposablePartDefinition>(removedParts);
 }
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:CatalogExportProvider.CatalogChangeProxy.cs


注:本文中的ComposablePartCatalog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。