次の方法で共有


AVAudioSession.Notifications.ObserveSilenceSecondaryAudioHint メソッド

定義

オーバーロード

ObserveSilenceSecondaryAudioHint(EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>)

定数に対して SilenceSecondaryAudioHintNotification 厳密に型指定された通知。

ObserveSilenceSecondaryAudioHint(NSObject, EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>)

定数に対して SilenceSecondaryAudioHintNotification 厳密に型指定された通知。

ObserveSilenceSecondaryAudioHint(EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>)

定数に対して SilenceSecondaryAudioHintNotification 厳密に型指定された通知。

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

パラメーター

handler
EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>

通知が投稿されたときに呼び出すメソッド。

戻り値

通知を破棄するか、またはに渡すことによって通知の受信を停止するために使用できるトークン オブジェクト RemoveObservers(IEnumerable<NSObject>)

注釈

次の例は、開発者がコードでこのメソッドを使用する方法を示しています。

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

適用対象

ObserveSilenceSecondaryAudioHint(NSObject, EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>)

定数に対して SilenceSecondaryAudioHintNotification 厳密に型指定された通知。

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

パラメーター

objectToObserve
NSObject

観察する特定のオブジェクト。

handler
EventHandler<AVAudioSessionSecondaryAudioHintEventArgs>

通知が発生したときに応答するハンドラー。

戻り値

通知を破棄するか、またはに渡すことによって通知の受信を停止するために使用できるトークン オブジェクト RemoveObservers(IEnumerable<NSObject>)

注釈

このメソッドは、通知を SilenceSecondaryAudioHintNotification サブスクライブするために使用できます。

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

適用対象