Пример #1
0
        public async Task <Dictionary <int, TodoItemViewModel> > LoadAsync(uint start, int size)
        {
            // constrain to count
            size = (int)start + size;
            if (size > Count)
            {
                size = Count;
            }

            var dictionary = new Dictionary <int, TodoItemViewModel>();

            foreach (var index in Enumerable.Range((int)start, size))
            {
                // fake delay for demo
                await Task.Delay(10);

                // fake data for demo
                var model     = _repository.Sample(1).First();
                var viewmodel = new ViewModels.TodoItemViewModel(model);
                dictionary.Add(index, viewmodel);
            }
            return(dictionary);
        }