Exemplo n.º 1
0
        public static YamsterNewMessage CreatePrivateConversation(YamsterCache yamsterCache, IEnumerable <YamsterUser> users)
        {
            var conversationsGroup = yamsterCache.GetGroupById(YamsterGroup.ConversationsGroupId);

            var newMessage = CreateNewThread(conversationsGroup);

            newMessage.CarbonCopyUsers.AddRange(users);
            return(newMessage);
        }
Exemplo n.º 2
0
        public virtual void Dispose()
        {
            if (!IsDisposed)
            {
                Invalidate();

                Query        = null;
                yamsterCache = null;
            }
        }
Exemplo n.º 3
0
 internal YamsterUser(long userId, YamsterCache yamsterCache)
     : base(yamsterCache)
 {
     this.userId = userId;
     this.dbUser = new DbUser()
     {
         UserId       = userId,
         FullName     = "(User #" + userId + ")",
         ChangeNumber = 0
     };
 }
Exemplo n.º 4
0
        internal YamsterThread(long threadId, YamsterGroup group, YamsterCache yamsterCache)
            : base(yamsterCache)
        {
            this.ThreadId     = threadId;
            this.Group        = group;
            this.participants = YamsterUserSet.EmptyUserSet;

            this.dbThreadState = new DbThreadState()
            {
                ThreadId     = threadId,
                ChangeNumber = 0
            };
        }
Exemplo n.º 5
0
        internal void UpdateConversation(DbConversation conversation, YamsterModelEventCollector eventCollector)
        {
            this.ConversationId = conversation.ConversationId;

            var users = new List <YamsterUser>(conversation.ParticipantUserIds.Count);

            foreach (long userId in conversation.ParticipantUserIds)
            {
                var user = YamsterCache.FetchUserById(userId, eventCollector);
                users.Add(user);
            }
            this.participants = new YamsterUserSet(users);
            eventCollector.NotifyAfterUpdate(this);
        }
Exemplo n.º 6
0
        internal YamsterMessage(long messageId, YamsterCache yamsterCache)
            : base(yamsterCache)
        {
            this.messageId = messageId;
            this.dbMessage = new DbMessage()
            {
                MessageId    = messageId,
                ChangeNumber = 0
            };

            this.dbMessageState = new DbMessageState()
            {
                MessageId    = messageId,
                ChangeNumber = 0
            };
        }
Exemplo n.º 7
0
        internal YamsterGroup(long groupId, YamsterCache yamsterCache)
            : base(yamsterCache)
        {
            this.groupId = groupId;

            this.dbGroup = new DbGroup()
            {
                GroupId      = groupId,
                GroupName    = "(Group #" + groupId + ")",
                ChangeNumber = 0
            };
            this.dbGroupState = new DbGroupState()
            {
                GroupId      = groupId,
                ChangeNumber = 0
            };
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
 internal YamsterModel(YamsterCache yamsterCache)
 {
     this.YamsterCache = yamsterCache;
     this.IsLoaded     = false;
 }
Exemplo n.º 10
0
 public YamsterModelView(AppContext appContext)
 {
     this.appContext   = appContext;
     this.yamsterCache = appContext.YamsterCache;
 }
Exemplo n.º 11
0
 public static YamsterNewMessage CreatePrivateConversation(YamsterCache yamsterCache, YamsterUser user)
 {
     return(CreatePrivateConversation(yamsterCache, new YamsterUser[] { user }));
 }