Partager via


WKInterfaceObject.Notifications.ObserveGuidedAccessStatusDidChange Méthode

Définition

Surcharges

ObserveGuidedAccessStatusDidChange(EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la GuidedAccessStatusDidChangeNotification constante.

public static Foundation.NSObject ObserveGuidedAccessStatusDidChange(EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveGuidedAccessStatusDidChange : 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 GuidedAccessStatusDidChangeNotification s’abonner aux notifications.

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

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

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

S’applique à

ObserveGuidedAccessStatusDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la GuidedAccessStatusDidChangeNotification constante.

public static Foundation.NSObject ObserveGuidedAccessStatusDidChange(Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveGuidedAccessStatusDidChange : 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 GuidedAccessStatusDidChangeNotification s’abonner aux notifications.

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

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

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

S’applique à