From abb795461417c6a06e5359ddb27cc1b5974b7f2c Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Fri, 12 Apr 2024 13:50:13 +0200 Subject: [PATCH] sort systems by name --- EliteBGS/Report.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/EliteBGS/Report.cs b/EliteBGS/Report.cs index 88ca471..d426c25 100644 --- a/EliteBGS/Report.cs +++ b/EliteBGS/Report.cs @@ -1,11 +1,12 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.ComponentModel; using System.Linq; using EDPlayerJournal.BGS; namespace EliteBGS; -public class SystemObjectives : INotifyPropertyChanged { +public class SystemObjectives : INotifyPropertyChanged, IComparable { public event PropertyChangedEventHandler PropertyChanged; private bool isenabled = true; @@ -23,6 +24,11 @@ public class SystemObjectives : INotifyPropertyChanged { public string SystemName { get; set; } = string.Empty; public List Objectives { get; set; } = new(); + + public int CompareTo(SystemObjectives other) { + if (other == null) return 1; + return string.Compare(SystemName, other.SystemName, StringComparison.OrdinalIgnoreCase); + } } public class Report { @@ -62,5 +68,7 @@ public class Report { } objective.UITransactions.Add(new UITransaction(t)); } + + SystemObjectives.Sort(); } }