Share via


MPMoviePlayerController.SourceTypeAvailableNotification Proprietà

Definizione

Costante di notifica per SourceTypeAvailable

[Foundation.Advice("Use MPMoviePlayerController.Notifications.ObserveSourceTypeAvailable helper method instead.")]
[Foundation.Field("MPMovieSourceTypeAvailableNotification", "MediaPlayer")]
[ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, "Use 'AVPlayerViewController' (AVKit) instead.")]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
public static Foundation.NSString SourceTypeAvailableNotification { [ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, "Use 'AVPlayerViewController' (AVKit) instead.")] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.SourceTypeAvailableNotification : Foundation.NSString

Valore della proprietà

La costante NSString deve essere usata come token per NSNotificationCenter.

Attributi

Commenti

Questa costante può essere usata con per NSNotificationCenter registrare un listener per questa notifica. Si tratta di una stringa NSString anziché di una stringa, perché questi valori possono essere usati come token in alcune librerie native anziché essere usati esclusivamente per il relativo contenuto stringa effettivo. Il parametro 'notification' per il callback contiene informazioni aggiuntive specifiche del tipo di notifica.

Se si vuole sottoscrivere questa notifica, è possibile usare la praticità MPMoviePlayerController.Notifications. Metodo M:MPMoviePlayerController.Notifications.ObserveSourceTypeAvailable* che offre accesso fortemente tipizzato ai parametri della notifica.

Nell'esempio seguente viene illustrato come usare la classe Notifications fortemente tipizzata per escludere le ipotesi dalle proprietà disponibili nella notifica:

//
// Lambda style
//

// listening
notification = MPMoviePlayerController.Notifications.ObserveSourceTypeAvailable ((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.ObserveSourceTypeAvailable (Callback);
}

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

L'esempio seguente illustra come usare la notifica con l'API DefaultCenter:

// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
        MPMoviePlayerController.SourceTypeAvailableNotification, (notification) => {Console.WriteLine ("Received the notification MPMoviePlayerController", notification); }


// Method style
void Callback (NSNotification notification)
{
    Console.WriteLine ("Received a notification MPMoviePlayerController", notification);
}

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (MPMoviePlayerController.SourceTypeAvailableNotification, Callback);
}

Si applica a