Edit

Share via


NSHttpCookieStorage.Notifications.ObserveAcceptPolicyChanged Method

Definition

Overloads

ObserveAcceptPolicyChanged(EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the AcceptPolicyChangedNotification constant.

ObserveAcceptPolicyChanged(NSObject, EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the AcceptPolicyChangedNotification constant.

ObserveAcceptPolicyChanged(EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the AcceptPolicyChangedNotification constant.

public static Foundation.NSObject ObserveAcceptPolicyChanged (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveAcceptPolicyChanged : 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 AcceptPolicyChangedNotification notifications.

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

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

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

Applies to

ObserveAcceptPolicyChanged(NSObject, EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the AcceptPolicyChangedNotification constant.

public static Foundation.NSObject ObserveAcceptPolicyChanged (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveAcceptPolicyChanged : 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 AcceptPolicyChangedNotification notifications.

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

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

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

Applies to