AVCaptureSession.Notifications.ObserveWasInterrupted Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Surcharges
ObserveWasInterrupted(EventHandler<NSNotificationEventArgs>) |
Notification fortement typée pour la WasInterruptedNotification constante. |
ObserveWasInterrupted(NSObject, EventHandler<NSNotificationEventArgs>) |
Notification fortement typée pour la WasInterruptedNotification constante. |
ObserveWasInterrupted(EventHandler<NSNotificationEventArgs>)
Notification fortement typée pour la WasInterruptedNotification constante.
public static Foundation.NSObject ObserveWasInterrupted (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveWasInterrupted : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Paramètres
- handler
- EventHandler<NSNotificationEventArgs>
Méthode à appeler lors de la publication de la notification.
Retours
Objet jeton qui peut être utilisé pour arrêter de recevoir des notifications en le supprimant ou en le transmettant à RemoveObservers(IEnumerable<NSObject>)
Remarques
L’exemple suivant montre comment utiliser cette méthode dans votre code
//
// 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 ();
}
S’applique à
ObserveWasInterrupted(NSObject, EventHandler<NSNotificationEventArgs>)
Notification fortement typée pour la WasInterruptedNotification constante.
public static Foundation.NSObject ObserveWasInterrupted (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveWasInterrupted : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Paramètres
- objectToObserve
- NSObject
Objet spécifique à observer.
- handler
- EventHandler<NSNotificationEventArgs>
Gestionnaire qui répond à la notification lorsqu’elle se produit.
Retours
Objet jeton qui peut être utilisé pour arrêter de recevoir des notifications en le supprimant ou en le transmettant à RemoveObservers(IEnumerable<NSObject>)
Remarques
Cette méthode peut être utilisée pour WasInterruptedNotification s’abonner aux notifications.
// 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 ();