public static void Sort(this IEnumerable <Timeline> timelines, ListSortCategory category, ListSortDirection direction) { foreach (var timeline in timelines) { timeline.Sort(category, direction); } }
public void Sort(ListSortCategory category, ListSortDirection direction) { lock (_thisLock) { View.SortDescriptions.Clear(); View.SortDescriptions.Add(new SortDescription(category.ToPropertyPath(), direction)); if (category != ListSortCategory.CreatedAt) { View.SortDescriptions.Add(new SortDescription(ListSortCategory.CreatedAt.ToPropertyPath(), direction)); } View.SortDescriptions.Add(new SortDescription(ListSortCategory.Id.ToPropertyPath(), direction)); } }
public static string ToPropertyPath(this ListSortCategory category) { switch (category) { case ListSortCategory.Id: return("ID"); case ListSortCategory.CreatedAt: return("CreatedAt"); case ListSortCategory.ScreenName: return("Sender.ScreenName"); default: return(string.Empty); } }