AVCaptureDevice.Notifications.ObserveWasDisconnected Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Überlädt
ObserveWasDisconnected(EventHandler<NSNotificationEventArgs>) |
Stark typisierte Benachrichtigung für die WasDisconnectedNotification Konstante. |
ObserveWasDisconnected(NSObject, EventHandler<NSNotificationEventArgs>) |
Stark typisierte Benachrichtigung für die WasDisconnectedNotification Konstante. |
ObserveWasDisconnected(EventHandler<NSNotificationEventArgs>)
Stark typisierte Benachrichtigung für die WasDisconnectedNotification Konstante.
public static Foundation.NSObject ObserveWasDisconnected (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveWasDisconnected : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Parameter
- handler
- EventHandler<NSNotificationEventArgs>
Methode zum Aufrufen, wenn die Benachrichtigung veröffentlicht wird.
Gibt zurück
Tokenobjekt, das verwendet werden kann, um den Empfang von Benachrichtigungen zu beenden, indem es entweder veräußert oder an übergeben wird RemoveObservers(IEnumerable<NSObject>)
Hinweise
Das folgende Beispiel zeigt, wie Sie diese Methode in Ihrem Code verwenden können.
//
// Lambda style
//
// listening
notification = AVCaptureDevice.Notifications.ObserveWasDisconnected ((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.ObserveWasDisconnected (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Gilt für:
ObserveWasDisconnected(NSObject, EventHandler<NSNotificationEventArgs>)
Stark typisierte Benachrichtigung für die WasDisconnectedNotification Konstante.
public static Foundation.NSObject ObserveWasDisconnected (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveWasDisconnected : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Parameter
- objectToObserve
- NSObject
Das spezifische zu beobachtende Objekt.
- handler
- EventHandler<NSNotificationEventArgs>
Der Handler, der auf die Benachrichtigung reagiert, wenn sie auftritt.
Gibt zurück
Tokenobjekt, das verwendet werden kann, um den Empfang von Benachrichtigungen zu beenden, indem es entweder veräußert oder an übergeben wird RemoveObservers(IEnumerable<NSObject>)
Hinweise
Diese Methode kann verwendet werden, um Benachrichtigungen zu abonnieren WasDisconnectedNotification .
// Listen to all notifications posted for any object
var token = AVCaptureDevice.Notifications.ObserveWasDisconnected ((notification) => {
Console.WriteLine ("Observed WasDisconnectedNotification!");
};
// Listen to all notifications posted for a single object
var token = AVCaptureDevice.Notifications.ObserveWasDisconnected (objectToObserve, (notification) => {
Console.WriteLine ($"Observed WasDisconnectedNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();