Intermediate fleet summaries attempt
This commit is contained in:
@ -37,84 +37,11 @@ public class FleetManager : IEnableLogger, IDisposable
|
||||
public IObservableCache<FleetSummaryByDestination, string> FleetSummariesByDestination
|
||||
=> _fleetSummariesByDestination.AsObservableCache();
|
||||
|
||||
/// <summary>
|
||||
/// Public accessor to the continously updated fleet summaries.
|
||||
/// </summary>
|
||||
// public IObservableCache<FleetSummaryByDestination, string> FleetSummariesByDestination => _fleetSummaries.AsObservableCache();
|
||||
|
||||
/// <summary>
|
||||
/// Disposal tracking
|
||||
/// </summary>
|
||||
// private IDisposable _fleetSummariesSubscription;
|
||||
|
||||
public FleetManager()
|
||||
{
|
||||
// CreateFleetSummariesLink();
|
||||
}
|
||||
|
||||
// [MemberNotNull(nameof(_fleetSummariesSubscription))]
|
||||
// protected void CreateFleetSummariesLink()
|
||||
// {
|
||||
// /*
|
||||
// _fleetSummariesSubscription = _fleets.Connect()
|
||||
// .Filter(fleet => fleet.TrueDestination != "-- ")
|
||||
// .Log(this, $"{DateTime.Now.ToLongTimeString()} fleetWatcher filter", fleet => $"{fleet}")
|
||||
// // .AutoRefreshOnObservable(fleet => fleet.WhenAnyValue(
|
||||
// // f => f.Ironium, f => f.Boranium, f => f.Germanium, f => f.Colonists))
|
||||
// .Log(this, $"{DateTime.Now.ToLongTimeString()} fleetWatcher refresh", fleet => $"{fleet}")
|
||||
// .GroupOn(fleet => fleet.TrueDestination)
|
||||
// .Log(this, $"{DateTime.Now.ToLongTimeString()} fleetWatcher group", grp => $"{grp.TotalChanges} detected")
|
||||
// .Transform(group => new FleetSummaryByDestination
|
||||
// {
|
||||
// Destination = group.GroupKey,
|
||||
// TotalIronium = group.List.Items.Sum(f => f.Ironium),
|
||||
// TotalBoranium = group.List.Items.Sum(f => f.Boranium),
|
||||
// TotalGermanium = group.List.Items.Sum(f => f.Germanium),
|
||||
// TotalColonists = group.List.Items.Sum(f => f.Colonists)
|
||||
// })
|
||||
|
||||
// .AddKey(fs => fs.Destination)
|
||||
// .Log(this, "FleetManager _fleetSummaries update", changes =>
|
||||
// $"{changes.Adds} adds, {changes.Updates} updates, {changes.Removes} removes"
|
||||
// )
|
||||
// .PopulateInto(_fleetSummaries)
|
||||
// ;
|
||||
// */
|
||||
|
||||
// /*
|
||||
// // Demo only
|
||||
// var sourceCache = new SourceCache<FleetSummaryByDestination, string>(fs => fs.Destination);
|
||||
// var tmp = fleetSummaries
|
||||
// .AddKey(fs => fs.Destination)
|
||||
// .PopulateInto(sourceCache);
|
||||
|
||||
// _fleetSummaries
|
||||
// .ObserveOn(RxApp.MainThreadScheduler)
|
||||
// .Bind(out summaries)
|
||||
// .DisposeMany()
|
||||
// .Subscribe();
|
||||
|
||||
// d1 = summaries
|
||||
// .Subscribe(Observer.Create<FleetSummaryByDestination>(f =>
|
||||
// {
|
||||
// this.Log().Debug($"FleetSummaryByDestination observed: {f}");
|
||||
// }
|
||||
// ));
|
||||
|
||||
// d2 = _fleetSummaries
|
||||
// .ObserveOn(RxApp.MainThreadScheduler)
|
||||
// .Subscribe(x =>
|
||||
// {
|
||||
// var lst = x.ToList();
|
||||
// foreach (var f in lst)
|
||||
// {
|
||||
// this.Log().Debug($"Reason {f.Reason}, Type {f.Type}: {f.Item.Current}");
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
// */
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Load the fleet records from the database and push them into our source cache.
|
||||
/// If the data has been freshly imported, call PostProcessImportedData first.
|
||||
@ -201,7 +128,6 @@ public class FleetManager : IEnableLogger, IDisposable
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
// _fleetSummariesSubscription.Dispose();
|
||||
_fleetSummariesByDestination.Dispose();
|
||||
_fleets.Dispose();
|
||||
}
|
||||
|
Reference in New Issue
Block a user