本文整理汇总了C#中IComponentModel.GetService方法的典型用法代码示例。如果您正苦于以下问题:C# IComponentModel.GetService方法的具体用法?C# IComponentModel.GetService怎么用?C# IComponentModel.GetService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IComponentModel
的用法示例。
在下文中一共展示了IComponentModel.GetService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CodeWindowManager
public CodeWindowManager(IVsCodeWindow codeWindow, IWpfTextView textView, IComponentModel componentModel)
{
_window = codeWindow;
_textView = textView;
_editorOperationsFactory = componentModel.GetService<IEditorOperationsFactoryService>();
_analyzer = componentModel.GetService<IPythonAnalyzer>();
}
示例2: PreviewEngine
public PreviewEngine(
string title,
string helpString,
string description,
string topLevelItemName,
Glyph topLevelGlyph,
Solution newSolution,
Solution oldSolution,
IComponentModel componentModel,
IVsImageService2 imageService,
bool showCheckBoxes = true)
{
_topLevelName = topLevelItemName;
_topLevelGlyph = topLevelGlyph;
_title = title;
_helpString = helpString;
_description = description;
_newSolution = newSolution.WithMergedLinkedFileChangesAsync(oldSolution, cancellationToken: CancellationToken.None).Result;
_oldSolution = oldSolution;
_diffSelector = componentModel.GetService<ITextDifferencingSelectorService>();
_editorFactory = componentModel.GetService<IVsEditorAdaptersFactoryService>();
_componentModel = componentModel;
this.ShowCheckBoxes = showCheckBoxes;
_imageService = imageService;
}
示例3: AbstractEditorFactory
protected AbstractEditorFactory(Package package)
{
_package = package ?? throw new ArgumentNullException(nameof(package));
_componentModel = (IComponentModel)ServiceProvider.GetService(typeof(SComponentModel));
_editorAdaptersFactoryService = _componentModel.GetService<IVsEditorAdaptersFactoryService>();
_contentTypeRegistryService = _componentModel.GetService<IContentTypeRegistryService>();
_waitIndicator = _componentModel.GetService<IWaitIndicator>();
}
示例4: GoToDefinitionAdorner
GoToDefinitionAdorner(IWpfTextView textTextView, IComponentModel componentModel) {
_textView = textTextView;
_classicationFormatMapService = componentModel.GetService<IClassificationFormatMapService>();
_classifier = componentModel.GetService<IViewClassifierAggregatorService>().GetClassifier(textTextView);
_adornmentLayer = textTextView.GetAdornmentLayer(AdornerName);
_textView.Closed += OnTextViewClosed;
}
示例5: MyToolWindow
public MyToolWindow()
: base(null)
{
this.Caption = Resources.ToolWindowTitle;
this.BitmapResourceID = 301;
this.BitmapIndex = 1;
_componentModel = (IComponentModel)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SComponentModel));
_invisibleEditorManager = (IVsInvisibleEditorManager)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsInvisibleEditorManager));
_editorAdapter = _componentModel.GetService<IVsEditorAdaptersFactoryService>();
_editorFactoryService = _componentModel.GetService<ITextEditorFactoryService>();
}
示例6: FSharpEditorFactory
public FSharpEditorFactory(Package parentPackage)
{
if (parentPackage == null)
{
throw new ArgumentNullException(nameof(parentPackage));
}
_parentPackage = parentPackage;
_componentModel = (IComponentModel)ServiceProvider.GetService(typeof(SComponentModel));
_editorAdaptersFactoryService = _componentModel.GetService<IVsEditorAdaptersFactoryService>();
_contentTypeRegistryService = _componentModel.GetService<IContentTypeRegistryService>();
}
示例7: TextInformationManager
public TextInformationManager(IServiceProvider serviceProvider, IComponentModel componentModel)
{
this.serviceProvider = serviceProvider;
this.componentModel = componentModel;
fontAndColorStorage = (IVsFontAndColorStorage) serviceProvider.GetService(typeof (SVsFontAndColorStorage));
fontAndColorUtilities = fontAndColorStorage as IVsFontAndColorUtilities;
fontAndColorCache = (IVsFontAndColorCacheManager)serviceProvider.GetService(typeof(SVsFontAndColorCacheManager));
textManager = (IVsTextManager) serviceProvider.GetService(typeof (SVsTextManager));
editorAdaptersFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>();
textStructureNavigatorSelectorService = componentModel.GetService<ITextStructureNavigatorSelectorService>();
classicationFormatMapService = componentModel.GetService<IClassificationFormatMapService>();
classificationAggregatorService = componentModel.GetService<IClassifierAggregatorService>();
}
示例8: DiagnosticService
DiagnosticService(IWpfTextView textView, IComponentModel componentModel) {
var viewTagAggregatorFactoryService = componentModel.GetService<IViewTagAggregatorFactoryService>();
var outliningManagerService = componentModel.GetService<IOutliningManagerService>();
_textView = textView;
_errorTagAggregator = viewTagAggregatorFactoryService.CreateTagAggregator<DiagnosticErrorTag>(textView);
_outliningManager = outliningManagerService.GetOutliningManager(textView);
_diagnosticMapping = new Dictionary<DiagnosticSeverity, ReadOnlyCollection<IMappingTagSpan<DiagnosticErrorTag>>>();
_waitingForAnalysis = true;
_textView.Closed += OnTextViewClosed;
_textView.TextBuffer.Changed += OnTextBufferChanged;
_errorTagAggregator.BatchedTagsChanged += OnBatchedTagsChanged;
}
示例9: AbstractDebuggerIntelliSenseContext
// Constructor for testing
protected AbstractDebuggerIntelliSenseContext(IWpfTextView wpfTextView,
ITextBuffer contextBuffer,
Microsoft.VisualStudio.TextManager.Interop.TextSpan[] currentStatementSpan,
IComponentModel componentModel,
IContentType contentType,
bool isImmediateWindow)
{
_textView = wpfTextView;
this.ContextBuffer = contextBuffer;
this.CurrentStatementSpan = currentStatementSpan[0];
_contentType = contentType;
this.ProjectionBufferFactoryService = componentModel.GetService<IProjectionBufferFactoryService>();
_bufferGraphFactoryService = componentModel.GetService<IBufferGraphFactoryService>();
_isImmediateWindow = isImmediateWindow;
}
示例10: InstallPackages
private void InstallPackages( IComponentModel services, XElement packages, IDictionary<string, string> packageVersions )
{
Contract.Requires( services != null );
Contract.Requires( packages != null );
Contract.Requires( packageVersions != null );
if ( packageVersions.Count == 0 )
return;
var extensionId = (string) packages.Attribute( "repositoryId" );
var installer = services.GetService<IVsPackageInstaller>();
var unzipped = false;
var skipAssemblyReferences = false;
var ignoreDependencies = false;
// although it's less efficient, we install the packages one at a time to display status.
// the mechanism to report back status is internal and can't be wired up without some
// crafty reflection hacks. this is a more straight forward alternative.
foreach ( var entry in packageVersions )
{
var packageVersion = new Dictionary<string, string>()
{
{ entry.Key, entry.Value }
};
// provide user feedback
DesignTimeEnvironment.StatusBar.Text = SR.PackageInstallStatus.FormatDefault( entry.Key, entry.Value );
// install the package from the vsix location
installer.InstallPackagesFromVSExtensionRepository( extensionId, unzipped, skipAssemblyReferences, ignoreDependencies, Project, packageVersion );
}
}
示例11: PythonRunSettings
public PythonRunSettings([Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider) {
_compModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
var opState = _compModel.GetService<IOperationState>();
opState.StateChanged += StateChange;
_dispatcher = Dispatcher.CurrentDispatcher;
_serviceProvider = serviceProvider;
}
示例12: CodeWindowManager
public CodeWindowManager(IVsCodeWindow codeWindow, IWpfTextView textView, IComponentModel componentModel)
{
_window = codeWindow;
_textView = textView;
_editorOperationsFactory = componentModel.GetService<IEditorOperationsFactoryService>();
_textView.Properties.AddProperty(typeof(CodeWindowManager), this);
}
示例13: FileChange
public FileChange(TextDocument left,
TextDocument right,
IComponentModel componentModel,
AbstractChange parent,
PreviewEngine engine,
IVsImageService2 imageService) : base(engine)
{
Contract.ThrowIfFalse(left != null || right != null);
this.Id = left != null ? left.Id : right.Id;
_left = left;
_right = right;
_imageService = imageService;
_componentModel = componentModel;
var bufferFactory = componentModel.GetService<ITextBufferFactoryService>();
var bufferText = left != null ?
left.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None) :
right.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None);
_buffer = bufferFactory.CreateTextBuffer(bufferText.ToString(), bufferFactory.InertContentType);
_encoding = bufferText.Encoding;
this.Children = ComputeChildren(left, right, CancellationToken.None);
this.parent = parent;
}
示例14: VsInteractiveWindow
internal VsInteractiveWindow(IComponentModel model, Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags)
{
_componentModel = model;
this.Caption = title;
_editorAdapters = _componentModel.GetService<IVsEditorAdaptersFactoryService>();
_evaluator = evaluator;
// The following calls this.OnCreate:
Guid clsId = this.ToolClsid;
Guid empty = Guid.Empty;
Guid typeId = providerId;
IVsWindowFrame frame;
var vsShell = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));
// we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
// destroyed when closed. We are really multi instance but we don't want to be closed.
ErrorHandler.ThrowOnFailure(
vsShell.CreateToolWindow(
(uint)(__VSCREATETOOLWIN.CTW_fInitNew | __VSCREATETOOLWIN.CTW_fToolbarHost | creationFlags),
(uint)instanceId,
this.GetIVsWindowPane(),
ref clsId,
ref typeId,
ref empty,
null,
title,
null,
out frame
)
);
this.Frame = frame;
}
示例15: ReplCSharpEditorSurface
public ReplCSharpEditorSurface()
{
_CurrentScriptName = System.IO.Path.GetFileName(VSTools.DefaultScriptFileName);
InitializeComponent();
this.DataContext = this;
_componentModel = (IComponentModel)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SComponentModel));
_EditorAdapterFactory = _componentModel.GetService<IVsEditorAdaptersFactoryService>();
}