AVCaptureSession.Notifications.ObserveWasInterrupted Método

Definição

Sobrecargas

ObserveWasInterrupted(EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a WasInterruptedNotification constante.

ObserveWasInterrupted(NSObject, EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a WasInterruptedNotification constante.

ObserveWasInterrupted(EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a WasInterruptedNotification constante.

public static Foundation.NSObject ObserveWasInterrupted (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveWasInterrupted : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parâmetros

handler
EventHandler<NSNotificationEventArgs>

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 você pode usar esse método em seu código

//
// Lambda style
//

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

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

Aplica-se a

ObserveWasInterrupted(NSObject, EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a WasInterruptedNotification constante.

public static Foundation.NSObject ObserveWasInterrupted (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveWasInterrupted : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parâmetros

objectToObserve
NSObject

O objeto específico a ser observado.

handler
EventHandler<NSNotificationEventArgs>

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 WasInterruptedNotification notificações.

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

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

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

Aplica-se a