private IObservable <Message> GetNextMessages( Chat chat, Message fromMessage) { var fromMessageId = fromMessage.MessageData.Id; return(_messageLoader.LoadNextMessages(chat, fromMessageId, 32)); }
private IObservable <Message> LoadNextMessages( Chat chat, Message fromMessage = null) { var fromMessageId = chat.ChatData.LastReadInboxMessageId; if (fromMessage != null) { fromMessageId = fromMessage.MessageData.Id; } return(_messageLoader.LoadNextMessages(chat, fromMessageId, 32)); }
private IObservable <Message> LoadNextMessages(Chat chat, IMessageLoader messageLoader) { var fromMessageId = chat.ChatData.LastReadInboxMessageId; if (_items.Count > 0) { var messageModel = (MessageModel)_items.Items.FirstOrDefault(i => i is MessageModel); if (messageModel != null) { fromMessageId = messageModel.Message.MessageData.Id; } } return(messageLoader.LoadNextMessages(chat, fromMessageId, 20)); }
public static IDisposable BindPromoted( this HomeModel model, IChatLoader chatLoader, IMessageLoader messageLoader, IMessageModelFactory messageModelFactory) { model.PromotedMessages = new ObservableCollectionExtended <MessageModel>(); return(chatLoader.LoadPromo() .SelectSeq(chat => { return messageLoader.LoadNextMessages(chat, 0, 10); }) .Accept(message => { var messageModel = messageModelFactory.CreateMessage(message); model.PromotedMessages.Add(messageModel); })); }