コード例 #1
0
        private void UnsubscribeFromNotifications()
        {
            Debug.Assert(_notificationToken != null);

            _notificationToken.Dispose();
            _notificationToken = null;
        }
コード例 #2
0
ファイル: RealmResults.cs プロジェクト: runt18/realm-dotnet
        private void UnsubscribeFromNotifications()
        {
            Debug.Assert(_notificationToken != null, "_notificationToken must not be null to unsubscribe.");

            _notificationToken?.Dispose();
            _notificationToken = null;
        }
コード例 #3
0
        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);
            });
        }
コード例 #4
0
        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));
            });
        }
コード例 #5
0
        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;
        }
コード例 #6
0
ファイル: RealmObject.cs プロジェクト: uvirra/realm-dotnet
        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);
                }
            });
        }
コード例 #7
0
        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));
                }
            });
        }
コード例 #8
0
        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;
        }
コード例 #9
0
ファイル: RealmResults.cs プロジェクト: runt18/realm-dotnet
        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;
        }
コード例 #10
0
 private void UnsubscribeFromNotifications()
 {
     _notificationToken?.Dispose();
     _notificationToken = null;
 }
コード例 #11
0
 private void UnsubscribeFromNotifications()
 {
     _notificationToken?.Dispose();
     _notificationToken            = null;
     _deliveredInitialNotification = false;
 }