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


C# ExportProvider.GetExportedValue方法代码示例

本文整理汇总了C#中ExportProvider.GetExportedValue方法的典型用法代码示例。如果您正苦于以下问题:C# ExportProvider.GetExportedValue方法的具体用法?C# ExportProvider.GetExportedValue怎么用?C# ExportProvider.GetExportedValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExportProvider的用法示例。


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

示例1: CreateBuffer

 public static ITextBuffer CreateBuffer(
     string contentType,
     ExportProvider exportProvider,
     params string[] lines)
 {
     var text = LinesToFullText(lines);
     var intContentType = exportProvider.GetExportedValue<IContentTypeRegistryService>().GetContentType(contentType);
     var buffer = exportProvider.GetExportedValue<ITextBufferFactoryService>().CreateTextBuffer(intContentType);
     buffer.Replace(new Span(0, 0), text);
     return buffer;
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:11,代码来源:EditorFactory.cs

示例2: CreateView

 public static IWpfTextView CreateView(
     string contentType,
     ExportProvider exportProvider,
     params string[] lines)
 {
     var buffer = CreateBuffer(contentType, exportProvider, lines);
     return exportProvider.GetExportedValue<ITextEditorFactoryService>().CreateTextView(buffer);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:8,代码来源:EditorFactory.cs

示例3: CreateView

        public static IWpfTextView CreateView(
            string contentType,
            ExportProvider exportProvider,
            params string[] lines)
        {
            TestWorkspace.ResetThreadAffinity();
            WpfTestCase.RequireWpfFact($"Creates an IWpfTextView through {nameof(EditorFactory)}.{nameof(CreateView)}");

            var buffer = CreateBuffer(contentType, exportProvider, lines);
            return exportProvider.GetExportedValue<ITextEditorFactoryService>().CreateTextView(buffer);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:11,代码来源:EditorFactory.cs

示例4: CreateProject

        private static TestHostProject CreateProject(
            XElement workspaceElement,
            XElement projectElement,
            ExportProvider exportProvider,
            TestWorkspace workspace,
            Dictionary<XElement, string> projectElementToAssemblyName,
            Dictionary<XElement, string> documentElementToFilePath,
            Dictionary<string, ITextBuffer> filePathToTextBufferMap,
            ref int projectId,
            ref int documentId)
        {
            var language = GetLanguage(workspace, projectElement);

            var assemblyName = GetAssemblyName(workspace, projectElement, ref projectId);
            projectElementToAssemblyName.Add(projectElement, assemblyName);

            string filePath;

            if (projectElement.Attribute(FilePathAttributeName) != null)
            {
                filePath = projectElement.Attribute(FilePathAttributeName).Value;
                if (string.Compare(filePath, NullFilePath, StringComparison.Ordinal) == 0)
                {
                    // allow explicit null file path
                    filePath = null;
                }
            }
            else
            {
                filePath = assemblyName +
                    (language == LanguageNames.CSharp ? ".csproj" :
                     language == LanguageNames.VisualBasic ? ".vbproj" : ("." + language));
            }

            var contentTypeRegistryService = exportProvider.GetExportedValue<IContentTypeRegistryService>();
            var languageServices = workspace.Services.GetLanguageServices(language);

            var compilationOptions = CreateCompilationOptions(workspace, projectElement, language);
            var parseOptions = GetParseOptions(projectElement, language, languageServices);

            var references = CreateReferenceList(workspace, projectElement);
            var analyzers = CreateAnalyzerList(workspace, projectElement);

            var documents = new List<TestHostDocument>();
            var documentElements = projectElement.Elements(DocumentElementName).ToList();
            foreach (var documentElement in documentElements)
            {
                var document = CreateDocument(
                    workspace,
                    workspaceElement,
                    documentElement,
                    language,
                    exportProvider,
                    languageServices,
                    filePathToTextBufferMap,
                    ref documentId);

                documents.Add(document);
                documentElementToFilePath.Add(documentElement, document.FilePath);
            }

            return new TestHostProject(languageServices, compilationOptions, parseOptions, assemblyName, references, documents, filePath: filePath, analyzerReferences: analyzers);
        }
开发者ID:nileshjagtap,项目名称:roslyn,代码行数:63,代码来源:TestWorkspaceFactory_XmlConsumption.cs


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