MPMoviePlayerController.Notifications.ObserveMediaPlaybackIsPreparedToPlayDidChange Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Surcharges
ObserveMediaPlaybackIsPreparedToPlayDidChange(NSObject, EventHandler<NSNotificationEventArgs>) |
Notification fortement typée pour la MediaPlaybackIsPreparedToPlayDidChangeNotification constante. |
ObserveMediaPlaybackIsPreparedToPlayDidChange(EventHandler<NSNotificationEventArgs>) |
Notification fortement typée pour la MediaPlaybackIsPreparedToPlayDidChangeNotification constante. |
ObserveMediaPlaybackIsPreparedToPlayDidChange(NSObject, EventHandler<NSNotificationEventArgs>)
Notification fortement typée pour la MediaPlaybackIsPreparedToPlayDidChangeNotification constante.
public static Foundation.NSObject ObserveMediaPlaybackIsPreparedToPlayDidChange (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveMediaPlaybackIsPreparedToPlayDidChange : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Paramètres
- objectToObserve
- NSObject
Objet à observer.
- handler
- EventHandler<NSNotificationEventArgs>
Méthode à appeler lorsque la notification est publiée.
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 MediaPlaybackIsPreparedToPlayDidChangeNotification s’abonner aux notifications.
// Listen to all notifications posted for any object
var token = MPMoviePlayerController.Notifications.ObserveMediaPlaybackIsPreparedToPlayDidChange ((notification) => {
Console.WriteLine ("Observed MediaPlaybackIsPreparedToPlayDidChangeNotification!");
};
// Listen to all notifications posted for a single object
var token = MPMoviePlayerController.Notifications.ObserveMediaPlaybackIsPreparedToPlayDidChange (objectToObserve, (notification) => {
Console.WriteLine ($"Observed MediaPlaybackIsPreparedToPlayDidChangeNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();
S’applique à
ObserveMediaPlaybackIsPreparedToPlayDidChange(EventHandler<NSNotificationEventArgs>)
Notification fortement typée pour la MediaPlaybackIsPreparedToPlayDidChangeNotification constante.
public static Foundation.NSObject ObserveMediaPlaybackIsPreparedToPlayDidChange (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveMediaPlaybackIsPreparedToPlayDidChange : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Paramètres
- handler
- EventHandler<NSNotificationEventArgs>
Méthode à appeler lorsque la notification est publiée.
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
L’exemple suivant montre comment utiliser cette méthode dans votre code
//
// Lambda style
//
// listening
notification = MPMoviePlayerController.Notifications.ObserveMediaPlaybackIsPreparedToPlayDidChange ((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 = MPMoviePlayerController.Notifications.ObserveMediaPlaybackIsPreparedToPlayDidChange (Callback);
}
void Teardown ()
{
notification.Dispose ();
}