VsShellUtilities Class

Definition

Provides static helper methods to use with the Visual Studio shell.

public ref class VsShellUtilities abstract sealed
public ref class VsShellUtilities abstract sealed
class VsShellUtilities abstract sealed
public static class VsShellUtilities
type VsShellUtilities = class
Public Class VsShellUtilities
Public Module VsShellUtilities
Inheritance
VsShellUtilities

Fields

LiveShareUriScheme

Properties

ShellIsInitialized

Determines whether the shell is initialized. The shell is initialized after the main window is visible and all services are available.

ShellIsShuttingDown

Determines whether the shell is shutting down. If the shell is shutting down, either the shell service won't be available at all or it will be both initialized and zombie. On startup the shell is zombie until it is initialized.

ShellIsZombie

The Shell will be in zombie state until initialized and while shutting down.

ShutdownToken

Gets a token that is canceled when the application is shutting down.

Methods

ApplyListViewThemeStyles(ListView)

Modifies a Windows Forms ListView control to use the new Explorer style theme.

ApplyTreeViewThemeStyles(TreeView)

Modifies a Windows Forms TreeView control to use the new Explorer style theme. Hot tracking is enabled by default.

ApplyTreeViewThemeStyles(TreeView, Boolean)

Modifies a Windows Forms TreeView control to use the new Explorer style theme.

ConvertLocalUriToRemoteUriAsync(Uri, CancellationToken, String)
Obsolete.
Obsolete.

Converts a local URI to a remote URI using a given provider's URI scheme.

ConvertRemoteUriToLocalUriAsync(Uri, CancellationToken)
Obsolete.
Obsolete.

Converts a remote URI using the provider's URI scheme to a local URI.

DownloadFileAsync(Uri, IProgress<OperationProgressData>, CancellationToken)
Obsolete.
Obsolete.

Downloads a remote file if it has not already been downloaded.

EmptyTaskList(IServiceProvider)

Empties the task list.

GetCfgProvider(IVsHierarchy)

Utility function to retreive the config provider object for a given project. It will use the established (by build manager) alghoritm fo accessing the config provider

  1. If project provides a browse object - QI from the browse object
  2. else if project implements IVsGetCfgProvider - use IVsGetCfgProvider::GetCfgProvider()
  3. finally QI for IVsCfgProvider on the project hierarchy itself.
GetDebugMode(IServiceProvider)

Gets the current debug mode of the shell, for example, design mode, running mode, or break mode.

GetDpiContext(Object)

Tries to get the DpiAwarenessContext from the given object by checking if it implements IVsDpiAware and asking for its __VSDPIMODE. If the given object doesn't implement IVsDpiAware it returns System awareness.

GetDpiContext(Object, DpiAwarenessContext)

Tries to get the DpiAwarenessContext from the given object by checking if it implements IVsDpiAware and asking for its __VSDPIMODE. If the given object doesn't implement IVsDpiAware it returns the given default context.

GetEnvironmentFont(IServiceProvider)

Retrieve the host's environment font as a Font.

GetErrorListItems(IServiceProvider)

Gets the items in the error list.

GetHierarchy(IServiceProvider, Guid)

Gets the hierarchy node that is specified by the project GUID.

GetMinimumDragDistance()

Gets the minimum drag distance that should signal the beginning of a drag operation.

GetMiscellaneousProject(IServiceProvider)

Gets the miscellaneous project from the current solution.

GetMiscellaneousProject(IServiceProvider, Boolean)

Returns the miscellaneous project in a solution.

GetOutputWindowPane(IServiceProvider, Guid)

Gets the output window pane that is specified by the GUID.

GetPackageExtensionPoint<TExtensionPoint,TInterface>(Guid, Guid)

Create an instance of an extension point from the given package. This is analagous to finding an "Export" of a given type (T) with instance metadata given by the "instance" Guid.

GetProject(IServiceProvider, String)

Returns a project for the specified document.

GetProvisionalViewingStatus(IVsHierarchy, UInt32)

Gets the provisional viewing status for an item in a project hierarchy.

GetProvisionalViewingStatus(String)

Gets the provisional viewing status for a file.

GetRDTDocumentInfo(IServiceProvider, String, IVsHierarchy, UInt32, IVsPersistDocData, UInt32)

Gets an IVsPersistDocData interface and a document cookie from the running document table for the specified document.

GetRemoteFileSystemProviderAsync(String, CancellationToken)
Obsolete.

Returns the remote file system provider for scheme.

GetRemoteFileSystemProviderAsync(String, IServiceBroker, CancellationToken)

Returns the remote file system provider for scheme.

GetRunningDocumentContents(IServiceProvider, String)

Gets the text of the specified file, if it exists in the running document table.

GetTaskItems(IServiceProvider)
Obsolete.

Gets a list of tasks.

GetTaskItems2(IServiceProvider)
Obsolete.

Gets a list of all task items.

GetTaskItems3(IServiceProvider)

Gets a list of all tasks items.

GetTextView(IVsWindowFrame)

Gets the text view in the specified window frame.

GetUIHierarchyWindow(IServiceProvider, Guid)

Gets a window for the given GUID.

GetWindowObject(IVsWindowFrame)

Gets the window that exists in the specified window frame.

IsDocumentOpen(IServiceProvider, String, Guid, IVsUIHierarchy, UInt32, IVsWindowFrame)

Determines whether the specified document is open.

IsDpiAware(Object)
IsInAutomationFunction(IServiceProvider)

Determines whether the extensibility object is currently executing an automation operation.

IsSolutionBuilding(IServiceProvider)

Determines whether the build manager is busy.

IsVisualStudioInDesignMode(IServiceProvider)

Determines whether Visual Studio is in design mode (as opposed to run mode or debug mode).

LaunchDebugger(IServiceProvider, VsDebugTargetInfo)

Starts the debugger.

LogError(String, String)

Logs the error.

LogMessage(String, String, __ACTIVITYLOG_ENTRYTYPE)

Logs the message.

LogWarning(String, String)

Logs a warning.

LookupPackageString(Guid, String)

If the given string is in the correct format to indicate a localized resource, then look it up in the given package. Accepted formats are "#nnnn" or "@nnnn" where nnnn is a decimal resource ID. The # prefix indicates a native resource and the @ prefix indicates a managed resource, however these are just hints. Either prefix will work whether the package's satellite DLL is managed or native.

OnPropertyChanged(IVsShell, Int32, Action<Object>)

Invokes a callback each time a shell property changes.

OpenAsMiscellaneousFile(IServiceProvider, String, String, Guid, String, Guid)

Opens the specified miscellaneous file in the specified editor.

OpenBrowser(String)

Open the user's default browser on the given URL. The default browser is set in the "Browse With..." UI The internal browser will not be used if the shell is in a modal state.

OpenBrowser(String, UInt32)

Open a browser on the given URL, with the given flags.

OpenDocument(IServiceProvider, String)

Opens the specified document.

OpenDocument(IServiceProvider, String, Guid, IVsUIHierarchy, UInt32, IVsWindowFrame)

Opens the specified document in the specified view.

OpenDocument(IServiceProvider, String, Guid, IVsUIHierarchy, UInt32, IVsWindowFrame, IVsTextView)

Opens the specified document in the specified logical view.

OpenDocumentWithSpecificEditor(IServiceProvider, String, Guid, Guid)

Opens the specified document by using the specified editor.

OpenDocumentWithSpecificEditor(IServiceProvider, String, Guid, Guid, IVsUIHierarchy, UInt32, IVsWindowFrame)

Opens the specified document by using the specified editor.

OpenSystemBrowser(String)

Open the system default browser on the given URL.

PreFocusOptionsPageComboBox(FrameworkElement, MouseDevice)

If the mouse is over a combobox, this method will force focus into it, but only if the calling options page doesn't already have keyboard focus.

PromptYesNo(String, String, OLEMSGICON, IVsUIShell)

Displays a message box that contains the specified title and prompts the user to respond (yes or no) to the specified message.

RenameDocument(IServiceProvider, String, String)

Renames the specified document.

SaveFileIfDirty(IServiceProvider, String)

Saves the specified file if it is dirty.

SaveFileIfDirty(IVsTextView)

If the file is dirty, saves it in the specified text view.

SetOleCmdText(IntPtr, String)

Utility function to set the actual text in OLECMDTEXT marshaled structure. Used in typical commad routing code (implementations of Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget)

ShowMessageBox(IServiceProvider, String, String, OLEMSGICON, OLEMSGBUTTON, OLEMSGDEFBUTTON)

Displays a message box with the specified message.

ShowToolsOptionsPage(Guid)

Invokes the Tools > Options dialog with the given page selected

ShowToolsOptionsPage<T>()

Invokes the Tools > Options dialog with the given page selected

ToDpiContext(__VSDPIMODE)

Converts a __VSDPIMODE to a DpiAwarenessContext. If an unsupported/unknown __VSDPIMODE is given, this method will throw a NotSupportedException.

TryGetPackageExtensionPoint<TExtensionPoint,TInterface>(Guid, Guid)

Create an instance of an extension point from the given package. This is analagous to finding an "Export" of a given type (T) with instance metadata given by the "instance" Guid.

TryOpenDocument(IServiceProvider, String, Guid, IVsUIHierarchy, UInt32, IVsWindowFrame)

Tries to open a document using the appropriate project.

WhenPropertyChanged(IVsShell, Int32, Action<Object>)

Invokes a callback when a shell property next changes.

Applies to