次の方法で共有


LocalAlertManager.RaiseLocalAlert Method (String, String, String)

 

Raises an alert for a health definition that is defined on the local computer.

Namespace:   Microsoft.WindowsServerSolutions.NetworkHealth.AlertFramework
Assembly:  AlertFramework (in AlertFramework.dll)

Syntax

public Alert RaiseLocalAlert(
    string featureName,
    string healthDefinitionName,
    string description
)
public:
Alert^ RaiseLocalAlert(
    String^ featureName,
    String^ healthDefinitionName,
    String^ description
)
Public Function RaiseLocalAlert (
    featureName As String,
    healthDefinitionName As String,
    description As String
) As Alert

Parameters

  • healthDefinitionName
    Type: System.String

    The name of the health definition.

Return Value

Type: Microsoft.WindowsServerSolutions.NetworkHealth.AlertFramework.Alert

An instance of Alert.

Exceptions

Exception Condition
AlertProviderException

Communication or connection errors occurred when calling the Alert Provider.

InvalidOperationException

The method was called from the Windows UI thread

Examples

The following code example shows how to raise a local alert:

string featureName = "FeatureName";
string healthDefinitionName = "HealthDefinitionName";
string description = "Description";
LocalAlertManager localAlertManager = new LocalAlertManager();

Alert alertRaised = localAlertManager.RaiseLocalAlert(
   featureName, healthDefinitionName, description);
Console.WriteLine("Alert" + alertRaised.ToString()+ "is raised");

Note

The FeatureName and the HealthDefinitionName are defined in the Definition.xml file for the add-in.

See Also

RaiseLocalAlert Overload
LocalAlertManager Class
Microsoft.WindowsServerSolutions.NetworkHealth.AlertFramework Namespace

Return to top