From 0e4ff616faacfd4b4e483c00a99b9b6fb9616d22 Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Tue, 14 Feb 2017 10:28:22 +0100 Subject: Added sorting by name and place. --- EventMaker/EventMaker/Model/EventCatalogSingleton.cs | 8 ++++---- EventMaker/EventMaker/ViewModel/EventViewModel.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/EventMaker/EventMaker/Model/EventCatalogSingleton.cs b/EventMaker/EventMaker/Model/EventCatalogSingleton.cs index 26a5d90..9c8713b 100644 --- a/EventMaker/EventMaker/Model/EventCatalogSingleton.cs +++ b/EventMaker/EventMaker/Model/EventCatalogSingleton.cs @@ -85,7 +85,7 @@ namespace EventMaker.Model sorted = false; for (int i = 0; i < Events.Count - 1; i++) { - if (string.CompareOrdinal(Events[i].Name, Events[i + 1].Name) == 1) + if (string.CompareOrdinal(Events[i].Name, Events[i + 1].Name) >= 0 ) { Events.Move(i, i + 1); sorted = true; @@ -100,7 +100,7 @@ namespace EventMaker.Model sorted = false; for (int i = 0; i < Events.Count - 1; i++) { - if (string.CompareOrdinal(Events[i].Name, Events[i + 1].Name) == -1) + if (string.CompareOrdinal(Events[i].Name, Events[i + 1].Name) <= 0) { Events.Move(i, i + 1); sorted = true; @@ -115,7 +115,7 @@ namespace EventMaker.Model sorted = false; for (int i = 0; i < Events.Count - 1; i++) { - if (string.CompareOrdinal(Events[i].Place, Events[i + 1].Place) == 1) + if (string.CompareOrdinal(Events[i].Place, Events[i + 1].Place) >= 0) { Events.Move(i, i + 1); sorted = true; @@ -130,7 +130,7 @@ namespace EventMaker.Model sorted = false; for (int i = 0; i < Events.Count - 1; i++) { - if (string.CompareOrdinal(Events[i].Place, Events[i + 1].Place) == -1) + if (string.CompareOrdinal(Events[i].Place, Events[i + 1].Place) <= 0) { Events.Move(i, i + 1); sorted = true; diff --git a/EventMaker/EventMaker/ViewModel/EventViewModel.cs b/EventMaker/EventMaker/ViewModel/EventViewModel.cs index b72672b..da6c47d 100644 --- a/EventMaker/EventMaker/ViewModel/EventViewModel.cs +++ b/EventMaker/EventMaker/ViewModel/EventViewModel.cs @@ -15,7 +15,7 @@ namespace EventMaker.ViewModel private static string _selectedSortValue = "date (ascending)"; public EventCatalogSingleton EventCatalogSingleton { get; set; } = EventCatalogSingleton.Instance; public static int SelectedEventIndex { get; set; } - public static ObservableCollection SortValues { get; set; } = new ObservableCollection() {"date (ascending)","date (descending)"/*, "name (ascending)","name (descending)" ,"place (ascending)", "place (descending)"*/ }; + public static ObservableCollection SortValues { get; set; } = new ObservableCollection() {"date (ascending)","date (descending)", "name (ascending)","name (descending)" ,"place (ascending)", "place (descending)" }; public static DateTimeOffset Date { get; set; } = DateTimeOffset.Now; public static TimeSpan Time { get; set; } public ICommand CreateEventCommand { get; set; } -- cgit v1.2.3