public static void Notify_DownloadCompleted(ModMetaData mod) { var downloading = AllButtons.OfType <ModButton_Downloading>() .FirstOrDefault(b => b.Identifier == mod.Identifier); var missing = AllButtons.OfType <ModButton_Missing>() .FirstOrDefault(b => b.Identifier == mod.Identifier); // add installed item to MBM var installed = ModButton_Installed.For(mod); if (missing != null && missing.Active) { Insert(installed, ActiveButtons.IndexOf(missing)); } else { TryAdd(installed); } Page_BetterModConfig.Instance.Selected = installed; TryRemove(downloading); TryRemove(missing); Page_BetterModConfig.Instance.Notify_ModsListChanged(); }
public static void Notify_Unsubscribed(string publishedFileId) { var button = AllButtons.OfType <ModButton_Installed>() .FirstOrDefault(b => b.Versions.Any(m => m.Source == ContentSource.SteamWorkshop && m.Identifier == publishedFileId)); var mod = button?.Versions.First(m => m.Source == ContentSource.SteamWorkshop && m.Identifier == publishedFileId); button?.Notify_VersionRemoved(mod); }