Class Notifications
A collection of services used to notify the user.
Inheritance
Inherited Members
Namespace: Community.VisualStudio.Toolkit
Assembly: Community.VisualStudio.Toolkit.dll
Syntax
public class Notifications
Methods
| Improve this Doc View SourceClearStatusbarAsync()
Clears all text from the status bar.
Declaration
public Task ClearStatusbarAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
EndStatusbarAnimationAsync(StatusAnimation)
Ends the animation on the status bar.
Declaration
public Task EndStatusbarAnimationAsync(StatusAnimation animation)
Parameters
Type | Name | Description |
---|---|---|
StatusAnimation | animation |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
GetActivityLogAsync()
Used to write log messaged to the ActivityLog.xml file.
Declaration
public Task<IVsActivityLog> GetActivityLogAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Microsoft.VisualStudio.Shell.Interop.IVsActivityLog> |
GetInfoBarUIFactoryAsync()
The Infobar is often referred to as the 'yellow' or 'gold' bar.
Declaration
public Task<object> GetInfoBarUIFactoryAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | Cast return object to Microsoft.VisualStudio.Shell.Interop.IVsInfoBarUIFactory |
GetStatusbarAsync()
Provides access to the environment's status bar.
Declaration
public Task<IVsStatusbar> GetStatusbarAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Microsoft.VisualStudio.Shell.Interop.IVsStatusbar> |
GetStatusbarTextAsync()
Gets the current text from the status bar.
Declaration
public Task<string> GetStatusbarTextAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> |
GetTaskStatusCenterAsync()
The Task Status Center is used to run background tasks and is located in the left-most side of the Status bar.
Declaration
public Task<IVsTaskStatusCenterService> GetTaskStatusCenterAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Microsoft.VisualStudio.TaskStatusCenter.IVsTaskStatusCenterService> |
Remarks
This is only available for Visual Studio 2019 (16.0).
GetThreadedWaitDialogAsync()
Used for background tasks that needs to block the UI if they take longer than the specified seconds.
Declaration
public Task<object> GetThreadedWaitDialogAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | Cast return object to Microsoft.VisualStudio.Shell.Interop.IVsThreadedWaitDialogFactory |
SetStatusbarTextAsync(String)
Sets the text in the status bar.
Declaration
public Task SetStatusbarTextAsync(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ShowConfirm(String, String)
Shows a yes/no/cancel message box .
Declaration
public bool ShowConfirm(string title, string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | |
System.String | message |
Returns
Type | Description |
---|---|
System.Boolean | true if the user clicks the 'Yes' button. |
ShowError(String, String)
Shows an error message box.
Declaration
public VSConstants.MessageBoxResult ShowError(string title, string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | |
System.String | message |
Returns
Type | Description |
---|---|
Microsoft.VisualStudio.VSConstants.MessageBoxResult | The result of which button on the message box was clicked. |
ShowMessage(String, String, OLEMSGICON, OLEMSGBUTTON, OLEMSGDEFBUTTON)
Shows a message box that is parented to the main Visual Studio window
Declaration
public VSConstants.MessageBoxResult ShowMessage(string title, string message, OLEMSGICON icon = OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON buttons = OLEMSGBUTTON.OLEMSGBUTTON_OKCANCEL, OLEMSGDEFBUTTON defaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | |
System.String | message | |
Microsoft.VisualStudio.Shell.Interop.OLEMSGICON | icon | |
Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON | buttons | |
Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON | defaultButton |
Returns
Type | Description |
---|---|
Microsoft.VisualStudio.VSConstants.MessageBoxResult | The result of which button on the message box was clicked. |
Examples
VS.Notifications.ShowMessage("Title", "The message");
|
Improve this Doc
View Source
ShowWarning(String, String)
Shows a warning message box.
Declaration
public VSConstants.MessageBoxResult ShowWarning(string title, string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | |
System.String | message |
Returns
Type | Description |
---|---|
Microsoft.VisualStudio.VSConstants.MessageBoxResult | The result of which button on the message box was clicked. |
StartStatusbarAnimationAsync(StatusAnimation)
Starts the animation on the status bar.
Declaration
public Task StartStatusbarAnimationAsync(StatusAnimation animation)
Parameters
Type | Name | Description |
---|---|---|
StatusAnimation | animation |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |