diff --git a/Stars Assistant/Services/FleetManager.cs b/Stars Assistant/Services/FleetManager.cs
index 2601593..24e0d8a 100644
--- a/Stars Assistant/Services/FleetManager.cs
+++ b/Stars Assistant/Services/FleetManager.cs
@@ -17,7 +17,7 @@ public class FleetManager
///
/// SourceCache for DynamicData views
///
- private SourceCache _fleets = new(f => f.Id);
+ private SourceList _fleets = new();
public FleetManager() {}
@@ -33,20 +33,27 @@ public class FleetManager
public void test()
{
- /*
- _fleetSummaries = _fleets.Connect()
- .Group(fleet => fleet.TrueDestination)
- .Transform(grouping => new FleetSummary
- {
- Destination = grouping.Key,
- TotalIronium = grouping.Items.Sum(f => f.Ironium),
- TotalBoranium = grouping.Items.Sum(f => f.Boranium),
- TotalGermanium = grouping.Items.Sum(f => f.Germanium),
- TotalColonists = grouping.Items.Sum(f => f.Colonists)
- })
- .Sort(SortExpressionComparer.Ascending(f => f.Planet))
- .AsObservableChangeSet(summary => summary.Planet);
- */
+ var xxxxx = _fleets.Connect()
+ .GroupOn(fleet => fleet.TrueDestination)
+ .Transform(group =>
+ group.List.Connect()
+ .ToCollection()
+ .Select(query =>
+ {
+ var iro = query.Sum(f => f.Ironium);
+ var bor = query.Sum(f => f.Boranium);
+ var ger = query.Sum(f => f.Germanium);
+ var col = query.Sum(f => f.Colonists);
+ return new FleetSummary
+ {
+ Destination = group.GroupKey,
+ TotalIronium = iro,
+ TotalBoranium = bor,
+ TotalGermanium = ger,
+ TotalColonists = col
+ };
+ })
+ );
}
///
@@ -60,7 +67,7 @@ public class FleetManager
_fleets.Edit(innerCache =>
{
innerCache.Clear();
- innerCache.AddOrUpdate(allFleets);
+ innerCache.Add(allFleets);
}
);
}