diff --git a/Stars Assistant/Services/FleetManager.cs b/Stars Assistant/Services/FleetManager.cs index 6100d34..946b7dc 100644 --- a/Stars Assistant/Services/FleetManager.cs +++ b/Stars Assistant/Services/FleetManager.cs @@ -36,6 +36,7 @@ public class FleetManager : IEnableLogger public override string ToString() => $"To {Destination}: {TotalIronium}I/{TotalBoranium}B/{TotalGermanium}G/{TotalColonists}C"; } + private IObservable>? _fleetSummaries; private ReadOnlyObservableCollection? 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(fs => fs.Destination); + var tmp = _fleetSummaries + .AddKey(fs => fs.Destination) + .PopulateInto(sourceCache); + _fleetSummaries .ObserveOn(RxApp.MainThreadScheduler) .Bind(out summaries)