public List <ToDoItem> PopulateList(int exception)
 {
     if (exception > 0)
     {
         List <ToDoItem> exceptionList = new List <ToDoItem>();
         foreach (var item in ToDoItemData.GetToDoItems())
         {
             if (item.Priority == exception)
             {
                 exceptionList.Add(item);
             }
         }
         return(exceptionList);
     }
     else
     {
         return(ToDoItemData.GetToDoItems());
     }
 }
Пример #2
0
        /// <summary>
        /// Gets the list of ToDoItems from the data store and applies the
        /// category filter as well as the correct pagination.
        /// </summary>
        private void PruneList()
        {
            ListToDisplay = ToDoItemData.GetToDoItems();

            if (!string.IsNullOrWhiteSpace(CategoryFilter))
            {
                ListToDisplay = ListToDisplay.FindAll(HasCategory);
            }

            int endIndex = NumberOfRecordsToDisplay + CurrentIndex;

            if (endIndex > ListToDisplay.Count)
            {
                ListToDisplay = ListToDisplay.GetRange(CurrentIndex, ListToDisplay.Count - CurrentIndex);
                EnableNext    = false;
            }
            else
            {
                ListToDisplay = ListToDisplay.GetRange(CurrentIndex, NumberOfRecordsToDisplay);
                EnableNext    = true;
            }
        }