Freigeben über


AVPlayerItem.Notifications.ObserveNewAccessLogEntry Methode

Definition

Überlädt

ObserveNewAccessLogEntry(EventHandler<NSNotificationEventArgs>)

Stark typisierte Benachrichtigung für die NewAccessLogEntryNotification Konstante.

ObserveNewAccessLogEntry(NSObject, EventHandler<NSNotificationEventArgs>)

Stark typisierte Benachrichtigung für die NewAccessLogEntryNotification Konstante.

ObserveNewAccessLogEntry(EventHandler<NSNotificationEventArgs>)

Stark typisierte Benachrichtigung für die NewAccessLogEntryNotification Konstante.

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

Parameter

handler
EventHandler<NSNotificationEventArgs>

Methode, die aufgerufen wird, wenn die Benachrichtigung bereitgestellt wird.

Gibt zurück

Tokenobjekt, das verwendet werden kann, um den Empfang von Benachrichtigungen zu beenden, indem es entweder entfernt oder an übergeben wird RemoveObservers(IEnumerable<NSObject>)

Hinweise

Das folgende Beispiel zeigt, wie Sie diese Methode in Ihrem Code verwenden können.

//
// Lambda style
//

// listening
notification = AVPlayerItem.Notifications.ObserveNewAccessLogEntry ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);
});

// To stop listening:
notification.Dispose ();

//
//Method style
//
NSObject notification;
void Callback (object sender, Foundation.NSNotificationEventArgs args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);
}

void Setup ()
{
    notification = AVPlayerItem.Notifications.ObserveNewAccessLogEntry (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

Gilt für:

ObserveNewAccessLogEntry(NSObject, EventHandler<NSNotificationEventArgs>)

Stark typisierte Benachrichtigung für die NewAccessLogEntryNotification Konstante.

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

Parameter

objectToObserve
NSObject

Das spezifische zu beobachtende Objekt.

handler
EventHandler<NSNotificationEventArgs>

Der Handler, der auf die Benachrichtigung reagiert, wenn sie auftritt.

Gibt zurück

Tokenobjekt, das verwendet werden kann, um den Empfang von Benachrichtigungen zu beenden, indem es entweder entfernt oder an übergeben wird RemoveObservers(IEnumerable<NSObject>)

Hinweise

Diese Methode kann verwendet werden, um Benachrichtigungen zu abonnieren NewAccessLogEntryNotification .

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

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

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

Gilt für: