NSExtensionContext.Notifications.ObserveHostWillEnterForeground Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Перегрузки
ObserveHostWillEnterForeground(EventHandler<NSNotificationEventArgs>) |
Строго типизированное уведомление для константы HostWillEnterForegroundNotification . |
ObserveHostWillEnterForeground(NSObject, EventHandler<NSNotificationEventArgs>) |
Строго типизированное уведомление для константы HostWillEnterForegroundNotification . |
ObserveHostWillEnterForeground(EventHandler<NSNotificationEventArgs>)
Строго типизированное уведомление для константы HostWillEnterForegroundNotification .
public static Foundation.NSObject ObserveHostWillEnterForeground (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveHostWillEnterForeground : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Параметры
- handler
- EventHandler<NSNotificationEventArgs>
Метод для вызова при публикации уведомления.
Возвращаемое значение
Объект токена, который можно использовать для прекращения получения уведомлений путем его удаления или передачи в RemoveObservers(IEnumerable<NSObject>)
Комментарии
Этот метод можно использовать для подписки на HostWillEnterForegroundNotification уведомления.
// 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 ();
Применяется к
ObserveHostWillEnterForeground(NSObject, EventHandler<NSNotificationEventArgs>)
Строго типизированное уведомление для константы HostWillEnterForegroundNotification .
public static Foundation.NSObject ObserveHostWillEnterForeground (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveHostWillEnterForeground : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Параметры
- objectToObserve
- NSObject
Объект для наблюдения.
- handler
- EventHandler<NSNotificationEventArgs>
Метод для вызова при публикации уведомления.
Возвращаемое значение
Объект токена, который можно использовать для прекращения получения уведомлений путем его удаления или передачи в RemoveObservers(IEnumerable<NSObject>)
Комментарии
Этот метод можно использовать для подписки на HostWillEnterForegroundNotification уведомления.
// 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 ();