Beispiel #1
0
        public MessagePuller(AppContext appContext)
        {
            this.appContext = appContext;

            yamsterArchiveDb = appContext.YamsterArchiveDb;
            yamsterCoreDb    = appContext.YamsterCoreDb;
            yamsterApi       = appContext.YamsterApi;

            HistoryLimitDays = 90;

            UpToDate = false;
        }
Beispiel #2
0
        public void ConnectDatabase(EventHandler <SQLiteDataContextUpgradeEventArgs> beforeUpgradeHandler,
                                    EventHandler afterUpgradeHandler)
        {
            if (this.DatabaseConnected)
            {
                throw new InvalidOperationException("The database is already connected");
            }

            this.sqliteMapper = new SQLiteMapper(this.DatabaseFilePath, createIfMissing: true);
            this.sqliteMapper.Open();
            this.yamsterArchiveDb = new YamsterArchiveDb(sqliteMapper,
                                                         beforeUpgradeHandler, afterUpgradeHandler);
            this.yamsterCoreDb = new YamsterCoreDb(yamsterArchiveDb);
            this.yamsterCache  = new YamsterCache(this);

            this.messagePuller = new MessagePuller(this);
        }
Beispiel #3
0
        public YamsterCoreDb(YamsterArchiveDb archiveDb)
            : base(archiveDb.Mapper, archiveDb.BeforeUpgradeHandler, archiveDb.AfterUpgradeHandler)
        {
            this.archiveDb = archiveDb;

            this.ChangeCheckIntervalMs = 1000;

            LastCheckForChanges = Environment.TickCount;

            UpgradeDatabase();

            archiveDb.ConversationRefInserted += archiveDb_ConversationRefInserted;
            archiveDb.GroupRefInserted        += archiveDb_GroupRefInserted;
            archiveDb.MessageInserted         += archiveDb_MessageInserted;
            archiveDb.UserRefInserted         += archiveDb_UserRefInserted;

            this.DiscardChanges();
        }