NSUbiquitousKeyValueStore.Notifications.ObserveDidChangeExternally Method

Definition

Overloads

ObserveDidChangeExternally(EventHandler<NSUbiquitousKeyValueStoreChangeEventArgs>)

Strongly typed notification for the DidChangeExternallyNotification constant.

public static Foundation.NSObject ObserveDidChangeExternally(EventHandler<Foundation.NSUbiquitousKeyValueStoreChangeEventArgs> handler);
static member ObserveDidChangeExternally : EventHandler<Foundation.NSUbiquitousKeyValueStoreChangeEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<NSUbiquitousKeyValueStoreChangeEventArgs>

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

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

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

Applies to

ObserveDidChangeExternally(NSObject, EventHandler<NSUbiquitousKeyValueStoreChangeEventArgs>)

Strongly typed notification for the DidChangeExternallyNotification constant.

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

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<NSUbiquitousKeyValueStoreChangeEventArgs>

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

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

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

Applies to