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

            if (source.IsPersistedToDB == false)
            {// Already persisted to DB.
                if (_persistenceHelper.InsertDynamicTyped <EventSource>(source) == false)
                {
                    SystemMonitor.OperationError("Failed to add source to DB.");
                }
            }

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

            // AddElement the items already in the source.
            List <EventBase> items = source.GetAllItemsFlat <EventBase>();

            source_ItemsAddingAcceptEvent(source, items);
        }
        void PlatformNewsManager_SourceAddedEvent(NewsManager manager, EventSource source)
        {
            if (_persistenceHelper == null)
            {
                SystemMonitor.OperationWarning("Can not operate, since persistence helper not available.");
                return;
            }

            if (source.IsPersistedToDB == false)
            {// Already persisted to DB.
                if (_persistenceHelper.InsertDynamicTyped<EventSource>(source) == false)
                {
                    SystemMonitor.OperationError("Failed to add source to DB.");
                }
            }

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

            // AddElement the items already in the source.
            List<EventBase> items = source.GetAllItemsFlat<EventBase>();
            source_ItemsAddingAcceptEvent(source, items);
        }