public void RefreshASIStates() { // Rebuild the list of shown ASIs if (SelectedTarget != null) { var selectedObject = SelectedASI; var installedASIs = SelectedTarget.GetInstalledASIs(); var installedKnownASIMods = installedASIs.OfType <KnownInstalledASIMod>(); var installedUnknownASIMods = installedASIs.OfType <UnknownInstalledASIMod>(); var notInstalledASIs = ASIManager.GetASIModsByGame(SelectedTarget.Game).Except(installedKnownASIMods.Select(x => x.AssociatedManifestItem.OwningMod)); DisplayedASIMods.ReplaceAll(installedKnownASIMods.OrderBy(x => x.AssociatedManifestItem.Name)); DisplayedASIMods.AddRange(installedUnknownASIMods.OrderBy(x => x.UnmappedFilename)); DisplayedASIMods.AddRange(notInstalledASIs.OrderBy(x => x.LatestVersion.Name)); // Attempt to re-select the existing object if (DisplayedASIMods.Contains(selectedObject)) { SelectedASI = selectedObject; } else { foreach (var v in DisplayedASIMods) { if (v is KnownInstalledASIMod kim && kim.AssociatedManifestItem.OwningMod == selectedObject) { SelectedASI = v; break; } } } //Application.Current.Dispatcher.Invoke(() => //{ // DisplayedASIMods.ReplaceAll(DisplayedASIMods.Where(x => x is ASIMod).ToList()); //}); ////Clear installation states //foreach (var asi in DisplayedASIMods) //{ // if (asi is ASIMod a) // { // //a.UIOnly_Installed = false; // //a.UIOnly_Outdated = false; // //a.InstalledInfo = null; // } //} } //InstalledASIs = GetInstalledASIMods(Game); //MapInstalledASIs(); //UpdateSelectionTexts(SelectedASI); }