本文整理汇总了C#中ServiceProvider.QueryService方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceProvider.QueryService方法的具体用法?C# ServiceProvider.QueryService怎么用?C# ServiceProvider.QueryService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceProvider
的用法示例。
在下文中一共展示了ServiceProvider.QueryService方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetSite
public virtual void SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp){
this.site = new ServiceProvider(psp);
extensions = new Hashtable();
ILocalRegistry3 localRegistry = (ILocalRegistry3)site.QueryService( VsConstants.SID_SLocalRegistry, typeof(ILocalRegistry3));
string root = null;
if (localRegistry != null) {
localRegistry.GetLocalRegistryRoot(out root);
}
using (RegistryKey rootKey = Registry.LocalMachine.OpenSubKey(root)) {
if (rootKey != null) {
string relpath = "Editors\\{"+this.GetType().GUID.ToString()+"}\\Extensions";
using (RegistryKey key = rootKey.OpenSubKey(relpath,false)) {
if (key != null) {
foreach (string ext in key.GetValueNames()) {
extensions.Add(ext.ToLower(),ext);
}
}
}
}
}
}
示例2: LanguagePreferences
/// <summary>
/// Gets the language preferences.
/// </summary>
public LanguagePreferences(ServiceProvider site, Guid langSvc, string editorName) {
this.site = site;
this.textMgr = (IVsTextManager)site.QueryService(VsConstants.SID_SVsTextManager, typeof(IVsTextManager));
this.langSvc = langSvc;
this.user = true;
this.editorName = editorName;
Init();
}