Compartir a través de


UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable Método

Definición

Sobrecargas

ObserveProtectedDataDidBecomeAvailable(NSObject, EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la constante P:UIKit.UIApplication.ProtectedDataDidBecomeAvailableNotification .

ObserveProtectedDataDidBecomeAvailable(EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la constante P:UIKit.UIApplication.ProtectedDataDidBecomeAvailableNotification .

ObserveProtectedDataDidBecomeAvailable(NSObject, EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la constante P:UIKit.UIApplication.ProtectedDataDidBecomeAvailableNotification .

public static Foundation.NSObject ObserveProtectedDataDidBecomeAvailable (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveProtectedDataDidBecomeAvailable : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parámetros

objectToObserve
NSObject

Objeto que se va a observar.

handler
EventHandler<NSNotificationEventArgs>

Método que se invoca cuando se publica la notificación.

Devoluciones

Objeto token que se puede usar para dejar de recibir notificaciones mediante su eliminación o su paso a RemoveObservers(IEnumerable<NSObject>)

Comentarios

Este método se puede usar para suscribirse a las notificaciones P:UIKit.UIApplication.ProtectedDataDidBecomeAvailableNotification .

// Listen to all notifications posted for any object
var token = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable ((notification) => {
	Console.WriteLine ("Observed ProtectedDataDidBecomeAvailableNotification!");
};

// Listen to all notifications posted for a single object
var token = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable (objectToObserve, (notification) => {
	Console.WriteLine ($"Observed ProtectedDataDidBecomeAvailableNotification for {nameof (objectToObserve)}!");
};

// Stop listening for notifications
token.Dispose ();

Se aplica a

ObserveProtectedDataDidBecomeAvailable(EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la constante P:UIKit.UIApplication.ProtectedDataDidBecomeAvailableNotification .

public static Foundation.NSObject ObserveProtectedDataDidBecomeAvailable (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveProtectedDataDidBecomeAvailable : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parámetros

handler
EventHandler<NSNotificationEventArgs>

Método que se invoca cuando se publica la notificación.

Devoluciones

Objeto token que se puede usar para dejar de recibir notificaciones mediante su eliminación o su paso a RemoveObservers(IEnumerable<NSObject>)

Comentarios

En el ejemplo siguiente se muestra cómo puede usar este método en el código.

//
// Lambda style
//

// listening
notification = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);
});

// To stop listening:
notification.Dispose ();

//
//Method style
//
NSObject notification;
void Callback (object sender, Foundation.NSNotificationEventArgs args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);
}

void Setup ()
{
    notification = UIApplication.Notifications.ObserveProtectedDataDidBecomeAvailable (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

Se aplica a