private void UnsubscribeFromNotifications() { Debug.Assert(_notificationToken != null); _notificationToken.Dispose(); _notificationToken = null; }
private void UnsubscribeFromNotifications() { Debug.Assert(_notificationToken != null, "_notificationToken must not be null to unsubscribe."); _notificationToken?.Dispose(); _notificationToken = null; }
private void SubscribeForNotifications() { Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing."); Realm.ExecuteOutsideTransaction(() => { var managedResultsHandle = GCHandle.Alloc(this); _notificationToken = Handle.Value.AddNotificationCallback(GCHandle.ToIntPtr(managedResultsHandle), NotificationsHelper.NotificationCallback); }); }
private void SubscribeForNotifications() { Debug.Assert(_keyNotificationToken == null, "_keyNotificationToken must be null before subscribing."); Realm.ExecuteOutsideTransaction(() => { var managedResultsHandle = GCHandle.Alloc(this); _keyNotificationToken = _dictionaryHandle.AddKeyNotificationCallback(GCHandle.ToIntPtr(managedResultsHandle)); }); }
private void SubscribeForNotifications() { Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing."); var managedResultsHandle = GCHandle.Alloc(this); var token = new NotificationTokenHandle(Handle.Value); var tokenHandle = Handle.Value.AddNotificationCallback(GCHandle.ToIntPtr(managedResultsHandle), RealmCollectionNativeHelper.NotificationCallback); token.SetHandle(tokenHandle); _notificationToken = token; }
private void SubscribeForNotifications() { Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing."); _realm.ExecuteOutsideTransaction(() => { if (ObjectHandle.IsValid) { var managedObjectHandle = GCHandle.Alloc(this, GCHandleType.Weak); _notificationToken = ObjectHandle.AddNotificationCallback(GCHandle.ToIntPtr(managedObjectHandle), NotificationsHelper.NotificationCallback); } }); }
private void SubscribeForNotifications() { Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing."); if (IsFrozen) { throw new RealmFrozenException("It is not possible to add a change listener to a frozen RealmObjectBase since it never changes."); } _realm.ExecuteOutsideTransaction(() => { if (ObjectHandle.IsValid) { var managedObjectHandle = GCHandle.Alloc(this, GCHandleType.Weak); _notificationToken = ObjectHandle.AddNotificationCallback(GCHandle.ToIntPtr(managedObjectHandle)); } }); }
private void SubscribeForNotifications() { Debug.Assert(_notificationToken == null); var managedResultsHandle = GCHandle.Alloc(this); var token = new NotificationTokenHandle(ResultsHandle); var tokenHandle = NativeResults.add_notification_callback(ResultsHandle, GCHandle.ToIntPtr(managedResultsHandle), RealmResultsNativeHelper.NotificationCallback);; RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { token.SetHandle(tokenHandle); } _notificationToken = token; }
private void SubscribeForNotifications() { Debug.Assert(_notificationToken == null, "_notificationToken must be null before subscribing."); var managedResultsHandle = GCHandle.Alloc(this); var token = new NotificationTokenHandle(ResultsHandle); var tokenHandle = ResultsHandle.AddNotificationCallback(GCHandle.ToIntPtr(managedResultsHandle), RealmResultsNativeHelper.NotificationCallback); RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { token.SetHandle(tokenHandle); } _notificationToken = token; }
private void UnsubscribeFromNotifications() { _notificationToken?.Dispose(); _notificationToken = null; }
private void UnsubscribeFromNotifications() { _notificationToken?.Dispose(); _notificationToken = null; _deliveredInitialNotification = false; }