populate fleet summaries into sourcecache
This commit is contained in:
parent
64c99fa1a0
commit
a383f63a61
@ -36,6 +36,7 @@ public class FleetManager : IEnableLogger
|
||||
|
||||
public override string ToString() => $"To {Destination}: {TotalIronium}I/{TotalBoranium}B/{TotalGermanium}G/{TotalColonists}C";
|
||||
}
|
||||
|
||||
private IObservable<IChangeSet<FleetSummary>>? _fleetSummaries;
|
||||
|
||||
private ReadOnlyObservableCollection<FleetSummary>? summaries;
|
||||
@ -59,26 +60,15 @@ public class FleetManager : IEnableLogger
|
||||
TotalGermanium = group.List.Items.Sum(f => f.Germanium),
|
||||
TotalColonists = group.List.Items.Sum(f => f.Colonists)
|
||||
})
|
||||
// .Transform(group =>
|
||||
// group.List.Connect()
|
||||
// .QueryWhenChanged(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
|
||||
// };
|
||||
// })
|
||||
// )
|
||||
;
|
||||
|
||||
// Demo only
|
||||
var sourceCache = new SourceCache<FleetSummary, string>(fs => fs.Destination);
|
||||
var tmp = _fleetSummaries
|
||||
.AddKey(fs => fs.Destination)
|
||||
.PopulateInto(sourceCache);
|
||||
|
||||
|
||||
_fleetSummaries
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Bind(out summaries)
|
||||
|
Loading…
Reference in New Issue
Block a user