Edit

Share via


NSHttpCookieStorage.Notifications.ObserveCookiesChanged Method

Definition

Overloads

ObserveCookiesChanged(EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the CookiesChangedNotification constant.

ObserveCookiesChanged(NSObject, EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the CookiesChangedNotification constant.

ObserveCookiesChanged(EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the CookiesChangedNotification constant.

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

Parameters

handler
EventHandler<NSNotificationEventArgs>

Method to invoke when the notification is posted.

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 for CookiesChangedNotification notifications.

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

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

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

Applies to

ObserveCookiesChanged(NSObject, EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the CookiesChangedNotification constant.

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

Parameters

objectToObserve
NSObject

The object to observe.

handler
EventHandler<NSNotificationEventArgs>

Method to invoke when the notification is posted.

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 for CookiesChangedNotification notifications.

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

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

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

Applies to