MPMoviePlayerController.Notifications.ObservePlaybackDidFinish Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Overload
ObservePlaybackDidFinish(NSObject, EventHandler<MPMoviePlayerFinishedEventArgs>) |
Notifica fortemente tipizzata per la PlaybackDidFinishNotification costante. |
ObservePlaybackDidFinish(EventHandler<MPMoviePlayerFinishedEventArgs>) |
Notifica fortemente tipizzata per la PlaybackDidFinishNotification costante. |
ObservePlaybackDidFinish(NSObject, EventHandler<MPMoviePlayerFinishedEventArgs>)
Notifica fortemente tipizzata per la PlaybackDidFinishNotification costante.
public static Foundation.NSObject ObservePlaybackDidFinish(Foundation.NSObject objectToObserve, EventHandler<MediaPlayer.MPMoviePlayerFinishedEventArgs> handler);
static member ObservePlaybackDidFinish : Foundation.NSObject * EventHandler<MediaPlayer.MPMoviePlayerFinishedEventArgs> -> Foundation.NSObject
Parametri
- objectToObserve
- NSObject
Oggetto da osservare.
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 PlaybackDidFinishNotification le notifiche.
// Listen to all notifications posted for any object
var token = MPMoviePlayerController.Notifications.ObservePlaybackDidFinish ((notification) => {
Console.WriteLine ("Observed PlaybackDidFinishNotification!");
};
// Listen to all notifications posted for a single object
var token = MPMoviePlayerController.Notifications.ObservePlaybackDidFinish (objectToObserve, (notification) => {
Console.WriteLine ($"Observed PlaybackDidFinishNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();
Si applica a
ObservePlaybackDidFinish(EventHandler<MPMoviePlayerFinishedEventArgs>)
Notifica fortemente tipizzata per la PlaybackDidFinishNotification costante.
public static Foundation.NSObject ObservePlaybackDidFinish(EventHandler<MediaPlayer.MPMoviePlayerFinishedEventArgs> handler);
static member ObservePlaybackDidFinish : EventHandler<MediaPlayer.MPMoviePlayerFinishedEventArgs> -> Foundation.NSObject
Parametri
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.ObservePlaybackDidFinish ((sender, args) => {
/* Access strongly typed args */
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("FinishReason", args.FinishReason);
});
// To stop listening:
notification.Dispose ();
//
//Method style
//
NSObject notification;
void Callback (object sender, MediaPlayer.MPMoviePlayerFinishedEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("FinishReason", args.FinishReason);
}
void Setup ()
{
notification = MPMoviePlayerController.Notifications.ObservePlaybackDidFinish (Callback);
}
void Teardown ()
{
notification.Dispose ();
}