Exemplo n.º 1
0
        private void AddMessages(IList <TLMessageBase> messages)
        {
            var isNewRow = false;
            var row      = Items.LastOrDefault();

            if (row == null || row.IsFull())
            {
                row      = new MessagesRow();
                isNewRow = true;
            }

            for (var i = 0; i < messages.Count; i++)
            {
                var message = messages[i] as TLMessage;
                if (message == null)
                {
                    continue;
                }
                if (message.HasTTL())
                {
                    continue;
                }

                if (message.Media is TLMessageMediaPhoto ||
                    message.IsVideo())
                {
                    _items.Add(message);
                    if (!row.AddMessage(message))
                    {
                        if (isNewRow)
                        {
                            AddToTimeKeyCollection(row);
                            Items.Add(row);
                        }

                        row      = new MessagesRow();
                        isNewRow = true;
                        row.AddMessage(message);
                    }
                }
            }

            if (isNewRow && !row.IsEmpty())
            {
                AddToTimeKeyCollection(row);
                Items.Add(row);
            }
        }
Exemplo n.º 2
0
        private void AddToTimeKeyCollection(MessagesRow row)
        {
            var date         = TLUtils.ToDateTime(row.Message1.Date);
            var yearMonthKey = new DateTime(date.Year, date.Month, 1);
            var timeKeyGroup = Media.FirstOrDefault(x => x.Key == yearMonthKey);

            if (timeKeyGroup != null)
            {
                timeKeyGroup.Add(row);
            }
            else
            {
                Media.Add(new TimeKeyGroup <MessagesRow>(yearMonthKey)
                {
                    row
                });
            }
        }
Exemplo n.º 3
0
 public void CancelDownloading(MessagesRow messageRow)
 {
 }