//////////////// public void LoadModListAsync() { //Task.Run( () => { ThreadPool.QueueUserWorkItem(_ => { this.IsPopulatingList = true; lock (UIControlPanel.ModDataListLock) { this.ModDataList.Clear(); } int i = 1; foreach (var mod in ModHelpers.GetAllMods()) { UIModData moditem = this.CreateModListItem(i++, mod); lock (UIControlPanel.ModDataListLock) { this.ModDataList.Add(moditem); } //if( ModMetaDataManager.HasGithub( moditem.Mod ) ) { moditem.CheckForNewVersionAsync(); } this.ModListUpdateRequired = true; this.IsPopulatingList = false; }); }
//////////////// public void LoadModListAsync() { ThreadPool.QueueUserWorkItem(_ => { this.IsPopulatingList = true; lock (UIModControlPanelTab.ModDataListLock) { this.ModDataList.Clear(); } var mymod = ModHelpersMod.Instance; int i = 1; foreach (var mod in ModListHelpers.GetAllLoadedModsPreferredOrder()) { UIModData moditem = this.CreateModListItem(i++, mod); lock (UIModControlPanelTab.ModDataListLock) { this.ModDataList.Add(moditem); } if (!ModHelpersMod.Config.DisableModMenuUpdates) { moditem.CheckForNewVersionAsync(); } } this.ModListUpdateRequired = true; this.IsPopulatingList = false; }); }
//////////////// public UIModData CreateModListItem(int i, Mod mod) { UIModControlPanelTab self = this; var elem = new UIModData(this.Theme, i, mod, false); this.Theme.ApplyListItem(elem); elem.OnMouseOver += delegate(UIMouseEvent evt, UIElement fromElem) { if (!(fromElem is UIModData)) { return; } if (self.Logic.CurrentMod != null && elem.Mod.Name == self.Logic.CurrentMod.Name) { return; } self.Theme.ApplyListItemLit(elem); }; elem.OnMouseOut += delegate(UIMouseEvent evt, UIElement fromElem) { if (!(fromElem is UIModData)) { return; } if (self.Logic.CurrentMod != null && elem.Mod.Name == self.Logic.CurrentMod.Name) { return; } self.Theme.ApplyListItem(elem); }; elem.OnClick += delegate(UIMouseEvent evt, UIElement fromElem) { if (!(fromElem is UIModData)) { return; } if (self.Logic.CurrentMod != null && elem.Mod.Name == self.Logic.CurrentMod.Name) { return; } if (self.AwaitingReport) { return; } self.SelectModFromList(elem); }; return(elem); }
//////////////// private void SelectModFromList(UIModData list_item) { Mod mod = list_item.Mod; if (this.CurrentModListItem != null) { this.Theme.ApplyListItem(this.CurrentModListItem); } this.Theme.ApplyListItemSelected(list_item); this.CurrentModListItem = list_item; this.Logic.SetCurrentMod(mod); if (!ModMetaDataManager.HasGithub(mod)) { this.DisableIssueInput(); } else { this.EnableIssueInput(); } }
public void ApplyModListItemSelected(UIModData panel) { this.ApplyListItemSelected(panel); }
public void ApplyModListItemLit(UIModData panel) { this.ApplyListItemLit(panel); }