Share via


NSExtensionContext.Notifications.ObserveHostWillEnterForeground Método

Definición

Sobrecargas

ObserveHostWillEnterForeground(EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la HostWillEnterForegroundNotification constante.

ObserveHostWillEnterForeground(NSObject, EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la HostWillEnterForegroundNotification constante.

ObserveHostWillEnterForeground(EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la HostWillEnterForegroundNotification constante.

public static Foundation.NSObject ObserveHostWillEnterForeground (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveHostWillEnterForeground : 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

Este método se puede usar para suscribirse HostWillEnterForegroundNotification a las notificaciones.

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

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

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

Se aplica a

ObserveHostWillEnterForeground(NSObject, EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la HostWillEnterForegroundNotification constante.

public static Foundation.NSObject ObserveHostWillEnterForeground (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveHostWillEnterForeground : 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 HostWillEnterForegroundNotification a las notificaciones.

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

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

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

Se aplica a