MPMusicPlayerControllerQueue.Notifications.ObserveDidChange Méthode

Définition

Surcharges

ObserveDidChange(EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la DidChangeNotification constante.

ObserveDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la DidChangeNotification constante.

ObserveDidChange(EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la DidChangeNotification constante.

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

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

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

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

S’applique à

ObserveDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notification fortement typée pour la DidChangeNotification constante.

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

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

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

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

S’applique à