Condividi tramite


MPMoviePlayerController.Notifications.ObserveWillExitFullscreen Metodo

Definizione

Overload

ObserveWillExitFullscreen(EventHandler<MPMoviePlayerFullScreenEventArgs>)

Notifica fortemente tipizzata per la WillExitFullscreenNotification costante.

ObserveWillExitFullscreen(NSObject, EventHandler<MPMoviePlayerFullScreenEventArgs>)

Notifica fortemente tipizzata per la WillExitFullscreenNotification costante.

ObserveWillExitFullscreen(EventHandler<MPMoviePlayerFullScreenEventArgs>)

Notifica fortemente tipizzata per la WillExitFullscreenNotification costante.

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

Parametri

handler
EventHandler<MPMoviePlayerFullScreenEventArgs>

Metodo da richiamare quando viene pubblicata la notifica.

Restituisce

Oggetto token che può essere usato per arrestare la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Nell'esempio seguente viene illustrato come gli sviluppatori possono usare questo metodo nel codice:

//
// 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 ();
}

Si applica a

ObserveWillExitFullscreen(NSObject, EventHandler<MPMoviePlayerFullScreenEventArgs>)

Notifica fortemente tipizzata per la WillExitFullscreenNotification costante.

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

Parametri

objectToObserve
NSObject

Oggetto da osservare.

handler
EventHandler<MPMoviePlayerFullScreenEventArgs>

Metodo da richiamare quando viene pubblicata la notifica.

Restituisce

Oggetto token che può essere usato per arrestare la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Questo metodo può essere usato per sottoscrivere WillExitFullscreenNotification le notifiche.

// 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 ();

Si applica a