Share via


AVCaptureSession.Notifications.ObserveDidStopRunning Metodo

Definizione

Overload

ObserveDidStopRunning(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la DidStopRunningNotification costante.

ObserveDidStopRunning(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la DidStopRunningNotification costante.

ObserveDidStopRunning(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la DidStopRunningNotification costante.

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

Parametri

handler
EventHandler<NSNotificationEventArgs>

Metodo da richiamare quando viene inviata la notifica.

Restituisce

Oggetto token che può essere usato per interrompere la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Nell'esempio seguente viene illustrato come usare questo metodo nel codice

//
// Lambda style
//

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

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

Si applica a

ObserveDidStopRunning(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la DidStopRunningNotification costante.

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

Parametri

objectToObserve
NSObject

Oggetto specifico da osservare.

handler
EventHandler<NSNotificationEventArgs>

Gestore che risponde alla notifica quando si verifica.

Restituisce

Oggetto token che può essere usato per interrompere la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Questo metodo può essere usato per sottoscrivere DidStopRunningNotification le notifiche.

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

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

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

Si applica a