Partilhar via


AVAudioSession.Notifications.ObserveSilenceSecondaryAudioHint Método

Definição

Sobrecargas

ObserveSilenceSecondaryAudioHint(EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>)

Notificação fortemente tipada para a SilenceSecondaryAudioHintNotification constante.

ObserveSilenceSecondaryAudioHint(NSObject, EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>)

Notificação fortemente tipada para a SilenceSecondaryAudioHintNotification constante.

ObserveSilenceSecondaryAudioHint(EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>)

Notificação fortemente tipada para a SilenceSecondaryAudioHintNotification constante.

public static Foundation.NSObject ObserveSilenceSecondaryAudioHint (EventHandler<AVFoundation.AVAudioSessionSecondaryAudioHintEventArgs> handler);
static member ObserveSilenceSecondaryAudioHint : EventHandler<AVFoundation.AVAudioSessionSecondaryAudioHintEventArgs> -> Foundation.NSObject

Parâmetros

handler
EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>

Método a ser invocado quando a notificação é postada.

Retornos

Objeto de token que pode ser usado para parar de receber notificações descartando-o ou passando-o para RemoveObservers(IEnumerable<NSObject>)

Comentários

O exemplo a seguir mostra como os desenvolvedores podem usar esse método em seu código:

//
// Lambda style
//

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

    Console.WriteLine ("Hint", args.Hint);
    Console.WriteLine ("HintType", args.HintType);
});

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

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

    Console.WriteLine ("Hint", args.Hint);
    Console.WriteLine ("HintType", args.HintType);
}

void Setup ()
{
    notification = AVAudioSession.Notifications.ObserveSilenceSecondaryAudioHint (Callback);
}

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

Aplica-se a

ObserveSilenceSecondaryAudioHint(NSObject, EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>)

Notificação fortemente tipada para a SilenceSecondaryAudioHintNotification constante.

public static Foundation.NSObject ObserveSilenceSecondaryAudioHint (Foundation.NSObject objectToObserve, EventHandler<AVFoundation.AVAudioSessionSecondaryAudioHintEventArgs> handler);
static member ObserveSilenceSecondaryAudioHint : Foundation.NSObject * EventHandler<AVFoundation.AVAudioSessionSecondaryAudioHintEventArgs> -> Foundation.NSObject

Parâmetros

objectToObserve
NSObject

O objeto específico a ser observado.

handler
EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>

O manipulador que responde à notificação quando ela ocorre.

Retornos

Objeto de token que pode ser usado para parar de receber notificações descartando-o ou passando-o para RemoveObservers(IEnumerable<NSObject>)

Comentários

Esse método pode ser usado para assinar SilenceSecondaryAudioHintNotification notificações.

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

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

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

Aplica-se a