intermediate broken
This commit is contained in:
parent
c77ef68e70
commit
40cf280127
@ -17,7 +17,7 @@ public class FleetManager
|
||||
/// <summary>
|
||||
/// SourceCache for DynamicData views
|
||||
/// </summary>
|
||||
private SourceCache<Fleet, int> _fleets = new(f => f.Id);
|
||||
private SourceList<Fleet> _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<FleetSummary>.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
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -60,7 +67,7 @@ public class FleetManager
|
||||
_fleets.Edit(innerCache =>
|
||||
{
|
||||
innerCache.Clear();
|
||||
innerCache.AddOrUpdate(allFleets);
|
||||
innerCache.Add(allFleets);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user