Share via


AVCaptureSession.Notifications.ObserveRuntimeError Metodo

Definizione

Overload

ObserveRuntimeError(EventHandler<AVCaptureSessionRuntimeErrorEventArgs>)

Notifica fortemente tipizzata per la RuntimeErrorNotification costante.

ObserveRuntimeError(NSObject, EventHandler<AVCaptureSessionRuntimeErrorEventArgs>)

Notifica fortemente tipizzata per la RuntimeErrorNotification costante.

ObserveRuntimeError(EventHandler<AVCaptureSessionRuntimeErrorEventArgs>)

Notifica fortemente tipizzata per la RuntimeErrorNotification costante.

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

Parametri

handler
EventHandler<AVCaptureSessionRuntimeErrorEventArgs>

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 = AVCaptureSession.Notifications.ObserveRuntimeError ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);

    Console.WriteLine ("Error", args.Error);
});

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

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

    Console.WriteLine ("Error", args.Error);
}

void Setup ()
{
    notification = AVCaptureSession.Notifications.ObserveRuntimeError (Callback);
}

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

Si applica a

ObserveRuntimeError(NSObject, EventHandler<AVCaptureSessionRuntimeErrorEventArgs>)

Notifica fortemente tipizzata per la RuntimeErrorNotification costante.

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

Parametri

objectToObserve
NSObject

Oggetto specifico da osservare.

handler
EventHandler<AVCaptureSessionRuntimeErrorEventArgs>

Gestore che risponde alla notifica quando si verifica.

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 RuntimeErrorNotification le notifiche.

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

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

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

Si applica a