Share via


NSPopover.Notifications.ObserveWillClose Method

Definition

Overloads

Name Description
ObserveWillClose(NSObject, EventHandler<NSPopoverCloseEventArgs>)

Strongly typed notification for the WillCloseNotification constant.

ObserveWillClose(EventHandler<NSPopoverCloseEventArgs>)

Strongly typed notification for the WillCloseNotification constant.

ObserveWillClose(NSObject, EventHandler<NSPopoverCloseEventArgs>)

Strongly typed notification for the WillCloseNotification constant.

public static Foundation.NSObject ObserveWillClose(Foundation.NSObject objectToObserve, EventHandler<AppKit.NSPopoverCloseEventArgs> handler);
static member ObserveWillClose : Foundation.NSObject * EventHandler<AppKit.NSPopoverCloseEventArgs> -> Foundation.NSObject

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<NSPopoverCloseEventArgs>

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 WillCloseNotification notifications.

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

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

Applies to

ObserveWillClose(EventHandler<NSPopoverCloseEventArgs>)

Strongly typed notification for the WillCloseNotification constant.

public static Foundation.NSObject ObserveWillClose(EventHandler<AppKit.NSPopoverCloseEventArgs> handler);
static member ObserveWillClose : EventHandler<AppKit.NSPopoverCloseEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<NSPopoverCloseEventArgs>

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 WillCloseNotification notifications.

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

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

Applies to