本文整理汇总了C#中System.IServiceProvider类的典型用法代码示例。如果您正苦于以下问题:C# IServiceProvider类的具体用法?C# IServiceProvider怎么用?C# IServiceProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IServiceProvider类属于System命名空间,在下文中一共展示了IServiceProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CompletionController
/// <summary>
/// Attaches events for invoking Statement completion
/// </summary>
/// <param name="subjectBuffers"></param>
/// <param name="textView"></param>
/// <param name="completionBrokerMap"></param>
internal CompletionController(IList<ITextBuffer> subjectBuffers, ITextView textView, ICompletionBroker completionBrokerMap, System.IServiceProvider serviceProvider)
{
this.subjectBuffers = subjectBuffers;
this.textView = textView;
this.completionBrokerMap = completionBrokerMap;
this.serviceProvider = serviceProvider;
}
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:13,代码来源:CompletionController.cs
示例2: GoToDefinitionFilterProvider
public GoToDefinitionFilterProvider(
[Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider,
IVsEditorAdaptersFactoryService editorFactory,
IEditorOptionsFactoryService editorOptionsFactory,
ITextDocumentFactoryService textDocumentFactoryService,
[Import(typeof(DotNetReferenceSourceProvider))] ReferenceSourceProvider referenceSourceProvider,
VSLanguageService fsharpVsLanguageService,
ProjectFactory projectFactory)
{
_serviceProvider = serviceProvider;
_editorFactory = editorFactory;
_editorOptionsFactory = editorOptionsFactory;
_textDocumentFactoryService = textDocumentFactoryService;
_referenceSourceProvider = referenceSourceProvider;
_fsharpVsLanguageService = fsharpVsLanguageService;
_projectFactory = projectFactory;
var dte = serviceProvider.GetService(typeof(SDTE)) as DTE;
var events = dte.Events as Events2;
if (events != null)
{
_solutionEvents = events.SolutionEvents;
_solutionEvents.AfterClosing += Cleanup;
}
}
开发者ID:bryanhunter,项目名称:VisualFSharpPowerTools,代码行数:25,代码来源:GotoDefinitionFilterProvider.cs
示例3: VisualStudioLogger
public VisualStudioLogger(System.IServiceProvider serviceProvider)
{
if(serviceProvider==null)
throw new ArgumentNullException();
_serviceProvider = serviceProvider;
}
开发者ID:pzielinski86,项目名称:RuntimeTestCoverage,代码行数:7,代码来源:VisualStudioLogger.cs
示例4: VsKeyProcessorAdditional
internal VsKeyProcessorAdditional(VsHost host, IVsTextView view, System.IServiceProvider provider)
{
_host = host;
_textView = view;
_serviceProvider = provider;
var hr = view.AddCommandFilter(this, out _nextTarget);
}
开发者ID:joycode,项目名称:LibNVim,代码行数:7,代码来源:VsKeyProcessorAdditional.cs
示例5: ShowMessageBox
/// <summary>
/// Use this instead of VsShellUtilities.ShowMessageBox because VSU uses ThreadHelper which
/// uses a private interface that can't be mocked AND goes to the global service provider.
/// </summary>
public static int ShowMessageBox(IServiceProvider serviceProvider, string message, string title, OLEMSGICON icon, OLEMSGBUTTON msgButton, OLEMSGDEFBUTTON defaultButton) {
IVsUIShell uiShell = serviceProvider.GetService(typeof(IVsUIShell)) as IVsUIShell;
Debug.Assert(uiShell != null, "Could not get the IVsUIShell object from the services exposed by this serviceprovider");
if (uiShell == null) {
throw new InvalidOperationException();
}
Guid emptyGuid = Guid.Empty;
int result = 0;
serviceProvider.GetUIThread().Invoke(() => {
ErrorHandler.ThrowOnFailure(uiShell.ShowMessageBox(
0,
ref emptyGuid,
title,
message,
null,
0,
msgButton,
defaultButton,
icon,
0,
out result));
});
return result;
}
开发者ID:bnavarma,项目名称:ScalaTools,代码行数:30,代码来源:Utilities.cs
示例6: VsCommandFilter
internal VsCommandFilter(IVimBuffer buffer, IVsTextView view, IServiceProvider provider)
{
_buffer = buffer;
_textView = view;
_serviceProvider = provider;
var hr = view.AddCommandFilter(this, out _nextTarget);
}
开发者ID:ChrisMarinos,项目名称:VsVim,代码行数:7,代码来源:VsCommandFilter.cs
示例7: EmptyTaskList
/// <include file='doc\VsShellUtilities.uex' path='docs/doc[@for="VsShellUtilities.EmptyTaskList"]/*' />
/// <devdoc>
/// Empty the task list.
/// </devdoc>
/// <param name="serviceProvider">The service provider.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code. </returns>
public static int EmptyTaskList(IServiceProvider serviceProvider)
{
if (serviceProvider == null)
{
throw new ArgumentException("serviceProvider");
}
IVsTaskList taskList = serviceProvider.GetService(typeof(IVsTaskList)) as IVsTaskList;
if (taskList == null)
{
throw new InvalidOperationException();
}
IVsEnumTaskItems enumTaskItems;
int result = VSConstants.S_OK;
try
{
ErrorHandler.ThrowOnFailure(taskList.EnumTaskItems(out enumTaskItems));
if (enumTaskItems == null)
{
throw new InvalidOperationException();
}
// Retrieve the task item text and check whether it is equal with one that supposed to be thrown.
uint[] fetched = new uint[1];
do
{
IVsTaskItem[] taskItems = new IVsTaskItem[1];
result = enumTaskItems.Next(1, taskItems, fetched);
if (fetched[0] == 1)
{
IVsTaskItem2 taskItem = taskItems[0] as IVsTaskItem2;
if (taskItem != null)
{
int canDelete;
ErrorHandler.ThrowOnFailure(taskItem.CanDelete(out canDelete));
if (canDelete == 1)
{
ErrorHandler.ThrowOnFailure(taskItem.OnDeleteTask());
}
}
}
} while (result == VSConstants.S_OK && fetched[0] == 1);
}
catch (COMException e)
{
Trace.WriteLine("Exception : " + e.Message);
result = e.ErrorCode;
}
return result;
}
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:65,代码来源:VsShellUtilities.cs
示例8: RenameDocument
/// <summary>
/// Rename document in the running document table from oldName to newName.
/// </summary>
/// <param name="provider">The service provider.</param>
/// <param name="oldName">Full path to the old name of the document.</param>
/// <param name="newName">Full path to the new name of the document.</param>
/// <param name="newItemId">The new item id of the document</param>
public static void RenameDocument(IServiceProvider site, string oldName, string newName, uint newItemId)
{
if(site == null)
{
throw new ArgumentNullException("site");
}
if(String.IsNullOrEmpty(oldName))
{
throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "oldName");
}
if(String.IsNullOrEmpty(newName))
{
throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "newName");
}
if(newItemId == VSConstants.VSITEMID_NIL)
{
throw new ArgumentNullException("newItemId");
}
IVsRunningDocumentTable pRDT = site.GetService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;
IVsUIShellOpenDocument doc = site.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument;
if(pRDT == null || doc == null) return;
IVsHierarchy pIVsHierarchy;
uint itemId;
IntPtr docData;
uint uiVsDocCookie;
ErrorHandler.ThrowOnFailure(pRDT.FindAndLockDocument((uint)_VSRDTFLAGS.RDT_NoLock, oldName, out pIVsHierarchy, out itemId, out docData, out uiVsDocCookie));
if(docData != IntPtr.Zero)
{
try
{
IntPtr pUnk = Marshal.GetIUnknownForObject(pIVsHierarchy);
Guid iid = typeof(IVsHierarchy).GUID;
IntPtr pHier;
Marshal.QueryInterface(pUnk, ref iid, out pHier);
try
{
ErrorHandler.ThrowOnFailure(pRDT.RenameDocument(oldName, newName, pHier, newItemId));
}
finally
{
if(pHier != IntPtr.Zero)
Marshal.Release(pHier);
if(pUnk != IntPtr.Zero)
Marshal.Release(pUnk);
}
}
finally
{
Marshal.Release(docData);
}
}
}
开发者ID:Rfvgyhn,项目名称:Boo-Plugin,代码行数:66,代码来源:DocumentManager.cs
示例9: TaskProvider
public TaskProvider(IServiceProvider site){
this.site = site;
this.taskList = (IVsTaskList)this.site.GetService(typeof(SVsTaskList));
items = new ArrayList();
RegisterProvider();
taskTokens = new TaskTokens(site);
taskTokens.Refresh();
}
开发者ID:hesam,项目名称:SketchSharp,代码行数:8,代码来源:TaskItem.cs
示例10: ToolWindowPane
/// <include file='doc\ToolWindowPane.uex' path='docs/doc[@for="ToolWindowPane.ToolWindowPane"]/*' />
/// <summary>
/// Constructor
/// </summary>
protected ToolWindowPane(IServiceProvider provider)
: base(provider)
{
toolClsid = Guid.Empty;
bitmapIndex = -1;
bitmapResourceID = -1;
toolBarLocation = VSTWT_LOCATION.VSTWT_TOP;
}
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:12,代码来源:ToolWindowPane.cs
示例11: SpringQuickInfoSource
public SpringQuickInfoSource(ITextBuffer textBuffer, ITextStructureNavigatorSelectorService textStructureNavigatorSelectorService,
IVsEditorAdaptersFactoryService vsEditorAdaptersFactoryService, System.IServiceProvider serviceProvider)
{
this.textBuffer = textBuffer;
this.textStructureNavigatorSelectorService = textStructureNavigatorSelectorService;
this.vsEditorAdaptersFactoryService = vsEditorAdaptersFactoryService;
this.serviceProvider = serviceProvider;
}
开发者ID:koskedk,项目名称:spring-net-vsnet,代码行数:8,代码来源:SpringQuickInfoSource.cs
示例12: XmlResourceCompletionController
internal XmlResourceCompletionController(System.IServiceProvider serviceProvider, IVsTextView vsTextView, ITextView textView, ICompletionBroker completionBroker, ITextStructureNavigatorSelectorService textStructureNavigatorSelectorService)
{
this.serviceProvider = serviceProvider;
this.textView = textView;
this.completionBroker = completionBroker;
//add the command to the command chain
vsTextView.AddCommandFilter(this, out nextCommandTarget);
}
开发者ID:Xtremrules,项目名称:dot42,代码行数:9,代码来源:XmlResourceCompletionController.cs
示例13: OleMenuCommandService
/// <include file='doc\OleMenuCommandService.uex' path='docs/doc[@for="OleMenuCommandService.OleMenuCommandService1"]/*' />
/// <devdoc>
/// Creates a new menu command service.
/// </devdoc>
public OleMenuCommandService(IServiceProvider serviceProvider, IOleCommandTarget parentCommandTarget)
: base(serviceProvider)
{
if (parentCommandTarget == null) {
throw new ArgumentNullException("parentCommandTarget");
}
_parentTarget = parentCommandTarget;
_provider = serviceProvider;
}
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:13,代码来源:OleMenuCommandService.cs
示例14: AdminCommandTarget
public AdminCommandTarget(IServiceProvider provider) : base(provider)
{
_siteUrl =
() =>
provider
.GetRequiredService<IWebConnectionService>()
.GetConfig()
.SiteUrl;
}
开发者ID:rsdn,项目名称:janus,代码行数:9,代码来源:AdminCommandTarget.cs
示例15: AbstractObjectBrowserLibraryManager
protected AbstractObjectBrowserLibraryManager(string languageName, Guid libraryGuid, IServiceProvider serviceProvider)
: base(libraryGuid, serviceProvider)
{
_languageName = languageName;
var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
this.Workspace = componentModel.GetService<VisualStudioWorkspace>();
this.Workspace.WorkspaceChanged += OnWorkspaceChanged;
}
开发者ID:GloryChou,项目名称:roslyn,代码行数:9,代码来源:AbstractObjectBrowserLibraryManager.cs
示例16: SolutionListener
protected SolutionListener(IServiceProvider serviceProviderParameter)
{
Utilities.ArgumentNotNull("serviceProviderParameter", serviceProviderParameter);
this.serviceProvider = serviceProviderParameter;
this.solution = this.serviceProvider.GetService(typeof(SVsSolution)) as IVsSolution;
Debug.Assert(this.solution != null, "Could not get the IVsSolution object from the services exposed by this project");
Utilities.CheckNotNull(this.solution);
}
开发者ID:borota,项目名称:JTVS,代码行数:10,代码来源:SolutionListener.cs
示例17: EditFilter
public EditFilter(ITextView textView, IEditorOperations editorOps, IServiceProvider serviceProvider)
{
_textView = textView;
_textView.Properties[typeof(EditFilter)] = this;
_editorOps = editorOps;
_serviceProvider = serviceProvider;
//_componentModel = _serviceProvider.GetComponentModel();
//BraceMatcher.WatchBraceHighlights(textView, _componentModel);
}
开发者ID:jianboqi,项目名称:NimStudio,代码行数:10,代码来源:NSCodeWindow.cs
示例18: TextViewFilter
public TextViewFilter(IServiceProvider serviceProvider, IVsTextView vsTextView) {
var compModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
_vsEditorAdaptersFactoryService = compModel.GetService<IVsEditorAdaptersFactoryService>();
_debugger = (IVsDebugger)serviceProvider.GetService(typeof(IVsDebugger));
vsTextView.GetBuffer(out _vsTextLines);
_wpfTextView = _vsEditorAdaptersFactoryService.GetWpfTextView(vsTextView);
ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out _next));
}
开发者ID:wenh123,项目名称:PTVS,代码行数:10,代码来源:TextViewFilter.cs
示例19: GetForumId
private static int GetForumId(IServiceProvider provider, int? forumId)
{
if (forumId != null)
return forumId.Value;
var currentForum = provider
.GetRequiredService<IActiveForumService>()
.ActiveForum;
return currentForum?.ID ?? -1;
}
开发者ID:rsdn,项目名称:janus,代码行数:10,代码来源:ForumCommandTarget.cs
示例20: DialogContainerWithToolbar
/// <include file='doc\DialogContainerWithToolbar.uex' path='docs/doc[@for="DialogContainerWithToolbar.DialogContainerWithToolbar"]/*' />
/// <devdoc>
/// Constructor of the DialogContainerWithToolbar. This constructor allow the caller to set a IServiceProvider,
/// the conatined control and an additional IOleCommandTarget implementation that will be chained to the one
/// implemented by OleMenuCommandTarget.
/// </devdoc>
public DialogContainerWithToolbar(IServiceProvider sp, Control contained, IOleCommandTarget parentCommandTarget)
{
if (null == contained)
throw new ArgumentNullException("contained");
if (null == sp)
throw new ArgumentNullException("sp");
PrivateInit(sp, contained, parentCommandTarget);
}
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:16,代码来源:DialogContainerWithToolbar.cs
注:本文中的System.IServiceProvider类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论