Compartir a través de


MPMoviePlayerController.Notifications.ObserveWillExitFullscreen Método

Definición

Sobrecargas

ObserveWillExitFullscreen(EventHandler<MPMoviePlayerFullScreenEventArgs>)

Notificación fuertemente tipada para la WillExitFullscreenNotification constante.

ObserveWillExitFullscreen(NSObject, EventHandler<MPMoviePlayerFullScreenEventArgs>)

Notificación fuertemente tipada para la WillExitFullscreenNotification constante.

ObserveWillExitFullscreen(EventHandler<MPMoviePlayerFullScreenEventArgs>)

Notificación fuertemente tipada para la WillExitFullscreenNotification constante.

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

Parámetros

handler
EventHandler<MPMoviePlayerFullScreenEventArgs>

Método que se invoca cuando se publica la notificación.

Devoluciones

Objeto token que se puede usar para dejar de recibir notificaciones mediante su eliminación o su paso a RemoveObservers(IEnumerable<NSObject>)

Comentarios

En el ejemplo siguiente se muestra cómo los desarrolladores pueden usar este método en su código:

//
// Lambda style
//

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

    Console.WriteLine ("AnimationDuration", args.AnimationDuration);
    Console.WriteLine ("AnimationCurve", args.AnimationCurve);
});

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

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

    Console.WriteLine ("AnimationDuration", args.AnimationDuration);
    Console.WriteLine ("AnimationCurve", args.AnimationCurve);
}

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

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

Se aplica a

ObserveWillExitFullscreen(NSObject, EventHandler<MPMoviePlayerFullScreenEventArgs>)

Notificación fuertemente tipada para la WillExitFullscreenNotification constante.

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

Parámetros

objectToObserve
NSObject

Objeto que se va a observar.

handler
EventHandler<MPMoviePlayerFullScreenEventArgs>

Método que se invoca cuando se publica la notificación.

Devoluciones

Objeto token que se puede usar para dejar de recibir notificaciones mediante su eliminación o su paso a RemoveObservers(IEnumerable<NSObject>)

Comentarios

Este método se puede usar para suscribirse WillExitFullscreenNotification a las notificaciones.

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

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

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

Se aplica a