次の方法で共有


Alert.RepairAsync Method ()

 

Asynchronously repairs the alert on the local computer.

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

Syntax

public void RepairAsync()
public:
void RepairAsync()
Public Sub RepairAsync

Exceptions

Exception Condition
AlertProviderException

Communication or connection errors occurredwhen calling the Provider Registry Service.

Examples

The following code example shows how to get an instance of asynchronously repair an alert:

LocalAlertManager localAlertManager = new LocalAlertManager();

Alert alert = 
   localAlertManager.GetLocalAlert(featureName,healthDefinitionName);
bool repairActionPerformed = false;

if(alert.IsRepairDefined)
{
   alert.RepairAsync();
   repairActionPerformed = true;
}

if (repairActionPerformed)
{
   // check if the repair action has been run for the alert
   if (!alert.IsRepairable)
   {
      Console.WriteLine("Alert is repaired" + 
         alert.RepairActionPerformed);
   }
}

Note

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

See Also

LocalAlertManager
Alert Class
Microsoft.WindowsServerSolutions.NetworkHealth.AlertFramework Namespace

Return to top