Düzenle

Aracılığıyla paylaş


MPMoviePlayerController.Notifications.ObserveThumbnailImageRequestDidFinish Method

Definition

Overloads

ObserveThumbnailImageRequestDidFinish(EventHandler<MPMoviePlayerThumbnailEventArgs>)

Strongly typed notification for the ThumbnailImageRequestDidFinishNotification constant.

ObserveThumbnailImageRequestDidFinish(NSObject, EventHandler<MPMoviePlayerThumbnailEventArgs>)

Strongly typed notification for the ThumbnailImageRequestDidFinishNotification constant.

ObserveThumbnailImageRequestDidFinish(EventHandler<MPMoviePlayerThumbnailEventArgs>)

Strongly typed notification for the ThumbnailImageRequestDidFinishNotification constant.

public static Foundation.NSObject ObserveThumbnailImageRequestDidFinish (EventHandler<MediaPlayer.MPMoviePlayerThumbnailEventArgs> handler);
static member ObserveThumbnailImageRequestDidFinish : EventHandler<MediaPlayer.MPMoviePlayerThumbnailEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<MPMoviePlayerThumbnailEventArgs>

Method to invoke when the notification is posted.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>)

Remarks

The following example shows how developers can use this method in their code:

//
// Lambda style
//

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

    Console.WriteLine ("Image", args.Image);
    Console.WriteLine ("Time", args.Time);
    Console.WriteLine ("Error", args.Error);
});

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

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

    Console.WriteLine ("Image", args.Image);
    Console.WriteLine ("Time", args.Time);
    Console.WriteLine ("Error", args.Error);
}

void Setup ()
{
    notification = MPMoviePlayerController.Notifications.ObserveThumbnailImageRequestDidFinish (Callback);
}

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

Applies to

ObserveThumbnailImageRequestDidFinish(NSObject, EventHandler<MPMoviePlayerThumbnailEventArgs>)

Strongly typed notification for the ThumbnailImageRequestDidFinishNotification constant.

public static Foundation.NSObject ObserveThumbnailImageRequestDidFinish (Foundation.NSObject objectToObserve, EventHandler<MediaPlayer.MPMoviePlayerThumbnailEventArgs> handler);
static member ObserveThumbnailImageRequestDidFinish : Foundation.NSObject * EventHandler<MediaPlayer.MPMoviePlayerThumbnailEventArgs> -> Foundation.NSObject

Parameters

objectToObserve
NSObject

The object to observe.

handler
EventHandler<MPMoviePlayerThumbnailEventArgs>

Method to invoke when the notification is posted.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>)

Remarks

This method can be used to subscribe for ThumbnailImageRequestDidFinishNotification notifications.

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

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

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

Applies to