Пример #1
0
        public IReadOnlyList <ChatPost> GetChatMessages()
        {
            ModelUpdateChat dc;

            dc = _sessionClient.UpdateChat(Data.ChatsTime);
            if (dc == null)
            {
                Data.LastServerConnectFail = true;
                if (!Data.ServerConnected)
                {
                    Disconnected();
                }

                return(null);
            }

            Data.LastServerConnectFail = false;
            Data.LastServerConnect     = DateTime.UtcNow;
            var lastMessage = string.Empty;

            Data.ApplyChats(dc, ref lastMessage);
            var result = new List <ChatPost>(dc.Chats[0].Posts.Where(x => x.Time > Chanel2Server.LastOnlineTime));

            Chanel2Server.LastOnlineTime = Data.ChatsTime;

            return(result);
        }
Пример #2
0
        public void UpdateChats()
        {
            ModelUpdateChat dc;

            dc = _sessionClient.UpdateChat(Data.ChatsTime);
            if (dc == null)
            {
                Data.LastServerConnectFail = true;
                if (!Data.ServerConnected)
                {
                    Disconnected();
                }

                return;
            }

            Data.LastServerConnectFail = false;
            Data.LastServerConnect     = DateTime.UtcNow;
            var lastMessage = string.Empty;

            Data.ApplyChats(dc, ref lastMessage);
        }
Пример #3
0
        public void UpdateChats()
        {
            ModelUpdateChat dc = _sessionClient.UpdateChat(_modelUpdateTime);

            if (dc == null)
            {
                Data.LastServerConnectFail = true;
                if (Data.ServerConnected)
                {
                    Disconnected();
                }

                return;
            }

            _modelUpdateTime.Time      = dc.Time;
            _modelUpdateTime.Value     = dc.LastChatPostId;
            Data.LastServerConnectFail = false;
            Data.LastServerConnect     = DateTime.UtcNow;
            var lastMessage = string.Empty;

            Data.ApplyChats(dc, ref lastMessage);
        }