Beispiel #1
0
        void PlatformNewsManager_SourceRemovedEvent(NewsManager manager, EventSource source)
        {
            if (_persistenceHelper == null)
            {
                SystemMonitor.OperationWarning("Can not operate, since persistence helper not available.");
                return;
            }

            if (_persistenceHelper.Delete <EventSource>(new EventSource[] { source }) == false)
            {
                SystemMonitor.OperationError("Failed to delete source from DB.");
            }

            source.PersistenceDataUpdatedEvent -= new PersistenceDataUpdatedDelegate(source_PersistenceDataUpdatedEvent);
            source.ItemsAddedEvent             -= new EventSource.ItemsUpdateDelegate(source_ItemsAddingAcceptEvent);
            source.ItemsUpdatedEvent           -= new EventSource.ItemsUpdateDelegate(source_ItemsUpdatedEvent);

            _persistenceHelper.Delete <EventSource>(source);

            _persistenceHelper.Delete <EventBase>(new MatchExpression("SourceId", source.Id));
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        public bool RemoveEntry(DataStoreEntry entry)
        {
            lock (_entriesAndSessions)
            {
                if (_entriesAndSessions.RemoveByKey(entry) == false)
                {
                    return(false);
                }
            }

            lock (this)
            {
                _persistenceHelper.Delete <DataStoreEntry>(entry);
            }

            entry.ClearData();

            if (EntryRemovedEvent != null)
            {
                EntryRemovedEvent(this, entry);
            }

            return(true);
        }