Esempio n. 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();
        }
Esempio n. 2
0
        private void SortOnFileExecute()
        {
            // If the current sort character is for none or down, then sort ascending
            if (FileSortChar.Equals(SortChar.None) || FileSortChar.Equals(SortChar.Desc))
            {
                FileSortChar = UpdateSortChars(SortChar.Asc);
            }
            // Otherwise sort descending
            else if (FileSortChar.Equals(SortChar.Asc))
            {
                FileSortChar = UpdateSortChars(SortChar.Desc);
            }

            SortTaskCollection();
        }