次の方法で共有


LocalAlertManager.GetAllLocalAlertsAsync Method ()

 

Asynchronously returns a collection of Alert objects that represents the active alerts on the local computer.

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

Syntax

public void GetAllLocalAlertsAsync()
public:
void GetAllLocalAlertsAsync()
Public Sub GetAllLocalAlertsAsync

Exceptions

Exception Condition
AlertProviderException

Communication or connection errors occurred when calling the Alert Provider.

Remarks

Subscribe to the GetAllLocalAlertsCompleted event to be notified when this method finishes. The collection is updated when alerts are raised, cleared, or updated.

Examples

The following code example shows how to get all of the local alerts:

LocalAlertManager localAlertManager = new LocalAlertManager();

localAlertManager.GetAllLocalAlertsCompleted += 
   new EventHandler<GetAlertsCompletedEventArgs>(
      localAlertManager_GetAllLocalAlertsCompleted);
localAlertManager.GetAllLocalAlertsAsync();

The following code example shows the delegate method:

static void localAlertManager_GetAllLocalAlertsCompleted(
   object sender, EventArgs e)
{
   Console.WriteLine("Got all the local alerts...");
}

See Also

LocalAlertManager Class
Microsoft.WindowsServerSolutions.NetworkHealth.AlertFramework Namespace

Return to top