本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}