Partager via


WKInterfaceObject.Notifications.ObserveUnfocusedElementKey Méthode

Définition

Surcharges

ObserveUnfocusedElementKey(EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la constante P:WatchKit.WKInterfaceObject.UnfocusedElementKeyNotification .

ObserveUnfocusedElementKey(NSObject, EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la constante P:WatchKit.WKInterfaceObject.UnfocusedElementKeyNotification .

ObserveUnfocusedElementKey(EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la constante P:WatchKit.WKInterfaceObject.UnfocusedElementKeyNotification .

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

Paramètres

handler
EventHandler<NSNotificationEventArgs>

Méthode à appeler lors de la publication de la notification.

Retours

Objet jeton qui peut être utilisé pour arrêter de recevoir des notifications en le supprimant ou en le transmettant à RemoveObservers(IEnumerable<NSObject>)

Remarques

Cette méthode peut être utilisée pour s’abonner aux notifications P:WatchKit.WKInterfaceObject.UnfocusedElementKeyNotification .

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

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

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

S’applique à

ObserveUnfocusedElementKey(NSObject, EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la constante P:WatchKit.WKInterfaceObject.UnfocusedElementKeyNotification .

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

Paramètres

objectToObserve
NSObject

Objet à observer.

handler
EventHandler<NSNotificationEventArgs>

Méthode à appeler lors de la publication de la notification.

Retours

Objet jeton qui peut être utilisé pour arrêter de recevoir des notifications en le supprimant ou en le transmettant à RemoveObservers(IEnumerable<NSObject>)

Remarques

Cette méthode peut être utilisée pour s’abonner aux notifications P:WatchKit.WKInterfaceObject.UnfocusedElementKeyNotification .

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

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

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

S’applique à