Beispiel #1
0
        /// <summary>
        /// Sort Tasks based on the current sort character
        /// </summary>
        private void SortTaskCollection()
        {
            // Sort the tasks based on whatever sort is currently setup
            if (DescriptionSortChar.Equals(SortChar.Asc))
            {
                TaskCollection = new ObservableCollection <TaskListItemViewModel>(TaskCollection.OrderBy(o => o.Description).ToList());
            }
            else if (DescriptionSortChar.Equals(SortChar.Desc))
            {
                TaskCollection = new ObservableCollection <TaskListItemViewModel>(TaskCollection.OrderByDescending(o => o.Description).ToList());
            }
            else if (FileSortChar.Equals(SortChar.Asc))
            {
                TaskCollection = new ObservableCollection <TaskListItemViewModel>(TaskCollection.OrderBy(o => o.Filename).ToList());
            }
            else if (FileSortChar.Equals(SortChar.Desc))
            {
                TaskCollection = new ObservableCollection <TaskListItemViewModel>(TaskCollection.OrderByDescending(o => o.Filename).ToList());
            }
            else if (LineSortChar.Equals(SortChar.Asc))
            {
                TaskCollection = new ObservableCollection <TaskListItemViewModel>(TaskCollection.OrderBy(o => o.Line).ToList());
            }
            else if (LineSortChar.Equals(SortChar.Desc))
            {
                TaskCollection = new ObservableCollection <TaskListItemViewModel>(TaskCollection.OrderByDescending(o => o.Line).ToList());
            }

            // Now refilter the items based on the sorted list
            FilteredTaskCollection = FilterTasks();
        }
Beispiel #2
0
        private void SortOnDescriptionExecute()
        {
            // If the current sort character is for none or down, then sort ascending
            if (DescriptionSortChar.Equals(SortChar.None) || DescriptionSortChar.Equals(SortChar.Desc))
            {
                DescriptionSortChar = UpdateSortChars(SortChar.Asc);
            }
            // Otherwise sort descending
            else if (DescriptionSortChar.Equals(SortChar.Asc))
            {
                DescriptionSortChar = UpdateSortChars(SortChar.Desc);
            }

            SortTaskCollection();
        }