Edit

Share via


WKInterfaceObject.Notifications.ObserveInvertColorsStatusDidChange Method

Definition

Overloads

ObserveInvertColorsStatusDidChange(EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the InvertColorsStatusDidChangeNotification constant.

ObserveInvertColorsStatusDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the InvertColorsStatusDidChangeNotification constant.

ObserveInvertColorsStatusDidChange(EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the InvertColorsStatusDidChangeNotification constant.

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

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

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

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

Applies to

ObserveInvertColorsStatusDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the InvertColorsStatusDidChangeNotification constant.

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

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

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

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

Applies to