diff options
author | marcinzelent <marcin@zelent.net> | 2017-02-14 10:28:22 +0100 |
---|---|---|
committer | marcinzelent <marcin@zelent.net> | 2017-02-14 10:28:22 +0100 |
commit | 0e4ff616faacfd4b4e483c00a99b9b6fb9616d22 (patch) | |
tree | 247536fef03784e7092ac96f886c5905b99d05ae | |
parent | 8b75d41c52fd9280c555ad2bf339af4ea95c340a (diff) |
Added sorting by name and place.
-rw-r--r-- | EventMaker/EventMaker/Model/EventCatalogSingleton.cs | 8 | ||||
-rw-r--r-- | 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<string> SortValues { get; set; } = new ObservableCollection<string>() {"date (ascending)","date (descending)"/*, "name (ascending)","name (descending)" ,"place (ascending)", "place (descending)"*/ }; + public static ObservableCollection<string> SortValues { get; set; } = new ObservableCollection<string>() {"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; } |