public static Guid GetDteClsid(IHostPlugin serviceProvider) { try { var localRegistry4 = serviceProvider.GetService <SLocalRegistry>() as ILocalRegistry4; var pdwRegRootHandle = 0U; if (localRegistry4 != null) { string pbstrRoot; if (HResult.Succeeded(localRegistry4.GetLocalRegistryRootEx(2U, out pdwRegRootHandle, out pbstrRoot))) { switch (pdwRegRootHandle) { case 2147483649U: using (var registryKey = Registry.CurrentUser.OpenSubKey(pbstrRoot)) { if (registryKey != null) { var obj = registryKey.GetValue("ThisVersionDTECLSID"); if (obj is string) { Guid result; if (Guid.TryParse((string)obj, out result)) { return(result); } } } break; } case 2147483650U: using (var registryKey = Registry.LocalMachine.OpenSubKey(pbstrRoot)) { if (registryKey != null) { var obj = registryKey.GetValue("ThisVersionDTECLSID"); if (obj is string) { Guid result; if (Guid.TryParse((string)obj, out result)) { return(result); } } } break; } } } } } catch (Exception ex) { TeamFoundationTrace.TraceAndDebugFailException(ex); } return(new Guid()); }
public static IVsWindowFrame LaunchInWebBrowser(IHostPlugin plugin, string url, bool newWindow) { var webBrowsingService = plugin.GetService <SVsWebBrowsingService>() as IVsWebBrowsingService; IVsWindowFrame ppFrame = null; if (webBrowsingService != null) { var vswbnavigateflags = __VSWBNAVIGATEFLAGS.VSNWB_ForceNew; if (!newWindow) { vswbnavigateflags = __VSWBNAVIGATEFLAGS.VSNWB_AddToMRU; } webBrowsingService.Navigate(url, (uint)vswbnavigateflags, out ppFrame); } return(ppFrame); }
public static IVsWindowFrame LaunchInWebBrowser(IHostPlugin plugin, string url, string caption, bool newWindow, out IVsWebBrowser browser) { var webBrowsingService = plugin.GetService <SVsWebBrowsingService>() as IVsWebBrowsingService; var vscreatewebbrowser = (__VSCREATEWEBBROWSER)1057; if (!newWindow) { vscreatewebbrowser = __VSCREATEWEBBROWSER.VSCWB_AddToMRU; } var rguidOwner = new Guid(); IVsWindowFrame ppFrame = null; browser = null; if (webBrowsingService != null) { webBrowsingService.CreateWebBrowser((uint)vscreatewebbrowser, ref rguidOwner, caption, url, null, out browser, out ppFrame); } return(ppFrame); }
public static TfsTeamProjectCollection GetTfsTeamProjectCollection(IHostPlugin plugin) { return(plugin.GetService <ITeamFoundationContextManager2>().CurrentContext.TeamProjectCollection); }