AVCaptureDevice.Notifications.ObserveSubjectAreaDidChange Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Sobrecargas
ObserveSubjectAreaDidChange(EventHandler<NSNotificationEventArgs>) |
Notificación fuertemente tipada para la SubjectAreaDidChangeNotification constante. |
ObserveSubjectAreaDidChange(NSObject, EventHandler<NSNotificationEventArgs>) |
Notificación fuertemente tipada para la SubjectAreaDidChangeNotification constante. |
ObserveSubjectAreaDidChange(EventHandler<NSNotificationEventArgs>)
Notificación fuertemente tipada para la SubjectAreaDidChangeNotification constante.
public static Foundation.NSObject ObserveSubjectAreaDidChange (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveSubjectAreaDidChange : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Parámetros
- handler
- EventHandler<NSNotificationEventArgs>
Método que se invoca cuando se publica la notificación.
Devoluciones
Objeto token que se puede usar para dejar de recibir notificaciones mediante su eliminación o su paso a RemoveObservers(IEnumerable<NSObject>)
Comentarios
En el ejemplo siguiente se muestra cómo puede usar este método en el código.
//
// Lambda style
//
// listening
notification = AVCaptureDevice.Notifications.ObserveSubjectAreaDidChange ((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 = AVCaptureDevice.Notifications.ObserveSubjectAreaDidChange (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Se aplica a
ObserveSubjectAreaDidChange(NSObject, EventHandler<NSNotificationEventArgs>)
Notificación fuertemente tipada para la SubjectAreaDidChangeNotification constante.
public static Foundation.NSObject ObserveSubjectAreaDidChange (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveSubjectAreaDidChange : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Parámetros
- objectToObserve
- NSObject
Objeto específico que se va a observar.
- handler
- EventHandler<NSNotificationEventArgs>
Controlador que responde a la notificación cuando se produce.
Devoluciones
Objeto token que se puede usar para dejar de recibir notificaciones mediante su eliminación o su paso a RemoveObservers(IEnumerable<NSObject>)
Comentarios
Este método se puede usar para suscribirse SubjectAreaDidChangeNotification a las notificaciones.
// Listen to all notifications posted for any object
var token = AVCaptureDevice.Notifications.ObserveSubjectAreaDidChange ((notification) => {
Console.WriteLine ("Observed SubjectAreaDidChangeNotification!");
};
// Listen to all notifications posted for a single object
var token = AVCaptureDevice.Notifications.ObserveSubjectAreaDidChange (objectToObserve, (notification) => {
Console.WriteLine ($"Observed SubjectAreaDidChangeNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();