Exemple #1
0
        private async Task AddStatuses(IEnumerable <StatusViewModel> statuses, bool append = true)
        {
            var statusViewModels = statuses as StatusViewModel[] ?? statuses.ToArray();

            if (statusViewModels.Any())
            {
                SinceId = Math.Max(SinceId, statusViewModels.Max(s => s.Id));
                MaxId   = Math.Min(MaxId, statusViewModels.Min(s => s.Id));

                foreach (var s in statusViewModels)
                {
                    await UpdateCache(s.Model);

                    if (append)
                    {
                        await Dispatcher.RunAsync(() => StatusCollection.Add(s));
                    }
                    else
                    {
                        await Dispatcher.RunAsync(() => StatusCollection.Insert(0, s));
                    }
                }

                RaiseNewStatus(statusViewModels.Last());
            }
        }
Exemple #2
0
        private async Task AddStatus(StatusViewModel status, bool append = true)
        {
            SinceId = Math.Min(SinceId, status.Id);
            MaxId   = Math.Min(MaxId, status.Id);

            await Dispatcher.RunAsync(() =>
            {
                if (append)
                {
                    StatusCollection.Add(status);
                }
                else
                {
                    StatusCollection.Insert(0, status);
                }
            });

            RaiseNewStatus(status);

            await UpdateCache(status.Model);
        }