Поделиться через


WKInterfaceObject.Notifications.ObserveFocusedElementKey Метод

Определение

Перегрузки

ObserveFocusedElementKey(EventHandler<NSNotificationEventArgs>)

Строго типизированное уведомление для константы P:WatchKit.WKInterfaceObject.FocusedElementKeyNotification .

ObserveFocusedElementKey(NSObject, EventHandler<NSNotificationEventArgs>)

Строго типизированное уведомление для константы P:WatchKit.WKInterfaceObject.FocusedElementKeyNotification .

ObserveFocusedElementKey(EventHandler<NSNotificationEventArgs>)

Строго типизированное уведомление для константы P:WatchKit.WKInterfaceObject.FocusedElementKeyNotification .

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

Параметры

handler
EventHandler<NSNotificationEventArgs>

Метод, вызываемый при публикации уведомления.

Возвращаемое значение

Объект токена, который можно использовать для прекращения получения уведомлений путем удаления или передачи в RemoveObservers(IEnumerable<NSObject>)

Комментарии

Этот метод можно использовать для подписки на уведомления 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 ();

Применяется к

ObserveFocusedElementKey(NSObject, EventHandler<NSNotificationEventArgs>)

Строго типизированное уведомление для константы 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

Параметры

objectToObserve
NSObject

Объект для наблюдения.

handler
EventHandler<NSNotificationEventArgs>

Метод, вызываемый при публикации уведомления.

Возвращаемое значение

Объект токена, который можно использовать для прекращения получения уведомлений путем удаления или передачи в RemoveObservers(IEnumerable<NSObject>)

Комментарии

Этот метод можно использовать для подписки на уведомления 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 ();

Применяется к