Condividi tramite


WKInterfaceObject.Notifications.ObserveFocusedElementKey Metodo

Definizione

Overload

ObserveFocusedElementKey(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la costante P:WatchKit.WKInterfaceObject.FocusedElementKeyNotification .

ObserveFocusedElementKey(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la costante P:WatchKit.WKInterfaceObject.FocusedElementKeyNotification .

ObserveFocusedElementKey(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la costante P:WatchKit.WKInterfaceObject.FocusedElementKeyNotification .

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

Parametri

handler
EventHandler<NSNotificationEventArgs>

Metodo da richiamare quando viene inviata la notifica.

Restituisce

Oggetto token che può essere usato per interrompere la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Questo metodo può essere usato per sottoscrivere le notifiche P:WatchKit.WKInterfaceObject.FocusedElementKeyNotification .

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

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

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

Si applica a

ObserveFocusedElementKey(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la costante P:WatchKit.WKInterfaceObject.FocusedElementKeyNotification .

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

Parametri

objectToObserve
NSObject

Oggetto da osservare.

handler
EventHandler<NSNotificationEventArgs>

Metodo da richiamare quando viene inviata la notifica.

Restituisce

Oggetto token che può essere usato per interrompere la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Questo metodo può essere usato per sottoscrivere le notifiche P:WatchKit.WKInterfaceObject.FocusedElementKeyNotification .

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

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

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

Si applica a