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


C# IComponentModel.GetService方法代码示例

本文整理汇总了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>();
 }
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:CodeWindowManager.cs

示例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;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:25,代码来源:PreviewEngine.cs

示例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>();
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:9,代码来源:AbstractEditorFactory.cs

示例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;
        }
开发者ID:csharper2010,项目名称:Nav.Language.Extensions,代码行数:9,代码来源:GoToDefinitionAdorner.cs

示例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>();
        }
开发者ID:JoshVarty,项目名称:ProjectionBufferTutorial,代码行数:12,代码来源:MyToolWindow.cs

示例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>();
        }
开发者ID:liboz,项目名称:visualfsharp,代码行数:12,代码来源:FSharpEditorFactory.cs

示例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>();
 }
开发者ID:mmanela,项目名称:TextFormatPicker,代码行数:13,代码来源:TextInformationManager.cs

示例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;
        }
开发者ID:csharper2010,项目名称:Nav.Language.Extensions,代码行数:14,代码来源:DiagnosticService.cs

示例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;
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:16,代码来源:AbstractDebuggerIntelliSenseContext.cs

示例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 );
            }
        }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:32,代码来源:DbContextTemplateWizard.cs

示例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;
 }
开发者ID:zooba,项目名称:PTVS,代码行数:7,代码来源:PythonRunSettings.cs

示例12: CodeWindowManager

 public CodeWindowManager(IVsCodeWindow codeWindow, IWpfTextView textView, IComponentModel componentModel)
 {
     _window = codeWindow;
     _textView = textView;
     _editorOperationsFactory = componentModel.GetService<IEditorOperationsFactoryService>();
     _textView.Properties.AddProperty(typeof(CodeWindowManager), this);
 }
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:CodeWindowManager.cs

示例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;
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:25,代码来源:FileChange.cs

示例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;
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:34,代码来源:VsInteractiveWindow.cs

示例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>();
 }
开发者ID:pgourlain,项目名称:VSREPL,代码行数:8,代码来源:ReplCSharpEditorSurface.xaml.cs


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