Share via


NSFileHandle.Notifications.ObserveConnectionAccepted Method

Definition

Overloads

ObserveConnectionAccepted(EventHandler<NSFileHandleConnectionAcceptedEventArgs>)

Strongly typed notification for the ConnectionAcceptedNotification constant.

public static Foundation.NSObject ObserveConnectionAccepted(EventHandler<Foundation.NSFileHandleConnectionAcceptedEventArgs> handler);
static member ObserveConnectionAccepted : EventHandler<Foundation.NSFileHandleConnectionAcceptedEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<NSFileHandleConnectionAcceptedEventArgs>

The handler that responds to the notification when it occurs.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>).

Remarks

This method can be used to subscribe to ConnectionAcceptedNotification notifications.

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

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

Applies to

ObserveConnectionAccepted(NSObject, EventHandler<NSFileHandleConnectionAcceptedEventArgs>)

Strongly typed notification for the ConnectionAcceptedNotification constant.

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

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<NSFileHandleConnectionAcceptedEventArgs>

The handler that responds to the notification when it occurs.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>).

Remarks

This method can be used to subscribe to ConnectionAcceptedNotification notifications.

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

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

Applies to