using XFEEDToolBox.Core.Galaxy; using XFEEDToolBox.Core.Navigation; namespace XFEEDToolBox.ViewModels; public partial class ToolboxViewModel { private GalaxyRouteChoicesSourceKey? galaxyRouteChoicesSource; public string GalaxyRouteChoicesSourceKey=>galaxyRouteChoicesSource?.ToString()??""; private void ResetGalaxyCurrentRouteChoices() { if(galaxyRouteChoicesSource is null)return; galaxyRouteChoicesSource=null;OnPropertyChanged(nameof(GalaxyRouteChoicesSourceKey)); var next=GalaxyCurrentRouteChoices.ClearLive(GalaxyFilter);if(!ReferenceEquals(next,GalaxyFilter))GalaxyFilter=next; } private void MergeGalaxyCurrentRouteChoices(NativeGalaxyCatalog catalog,long epoch,GalaxyCurrentRouteChoices? choices) { if(epoch!=Volatile.Read(ref galaxySourceEpoch)||!ReferenceEquals(catalog,nativeGalaxy)||galaxyStreamSource!=catalog.ProcessId|| !CurrentPlayer.InGame||NavigationActive||runtime.FlightDriver is not NativeFlightControlDriver driver||driver.ProcessId!=catalog.ProcessId|| choices is not null&&choices.ContextSystemAddress!=CurrentPlayer.Navigation.CurrentSystemAddress)return; if(!catalog.SupportsRouteFilterChoices||choices is null){ResetGalaxyCurrentRouteChoices();return;} var key=new GalaxyRouteChoicesSourceKey(catalog.ProcessId,epoch,choices.ContextSystemAddress); if(galaxyRouteChoicesSource!=key){galaxyRouteChoicesSource=key;OnPropertyChanged(nameof(GalaxyRouteChoicesSourceKey));} // Captured ticks and source epoch metadata are kept outside the Filter // record. Identical rows do not restart view/cell/query lifetimes. var next=choices.MergeInto(GalaxyFilter);if(!ReferenceEquals(next,GalaxyFilter))GalaxyFilter=next; } }