Share via


UIPointerLockState.Notifications.ObserveDidChange Method

Definition

Overloads

ObserveDidChange(EventHandler<UIPointerLockStateDidChangeEventArgs>)

Strongly typed notification for the DidChangeNotification constant.

public static Foundation.NSObject ObserveDidChange(EventHandler<UIKit.UIPointerLockStateDidChangeEventArgs> handler);
static member ObserveDidChange : EventHandler<UIKit.UIPointerLockStateDidChangeEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<UIPointerLockStateDidChangeEventArgs>

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

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

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

Applies to

ObserveDidChange(NSObject, EventHandler<UIPointerLockStateDidChangeEventArgs>)

Strongly typed notification for the DidChangeNotification constant.

public static Foundation.NSObject ObserveDidChange(Foundation.NSObject objectToObserve, EventHandler<UIKit.UIPointerLockStateDidChangeEventArgs> handler);
static member ObserveDidChange : Foundation.NSObject * EventHandler<UIKit.UIPointerLockStateDidChangeEventArgs> -> Foundation.NSObject

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<UIPointerLockStateDidChangeEventArgs>

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

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

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

Applies to