Whenever ticking or unticking a checkbox for a mod, the UI will freeze while the CollectionView attempts to refresh. The code in question here is as follows:
Mod mod = ((sender as System.Windows.Controls.CheckBox).Tag as Mod);
mod.ListItem.IsSelected = true;
ResolveDependencies(mod);
App.SavedMods.Add(mod.name);
Properties.Settings.Default.SavedMods = String.Join(",", App.SavedMods.ToArray());
Properties.Settings.Default.Save();
RefreshModsList();
The line causing the lag here is the call to RefreshModsList. I've reviewed this code a little bit and we have a few options.
Force refresh a single GUI update so the checkbox appears to tick instantly
Run the refresh in the background
Optimise the refresh call
Honestly, I'm not 100% why the refresh call is there in the first place, the program seems to work perfectly fine without it. So, we might be able to completely remove the call.
Going through old issues, and I am also not seeing any benefit for refreshing the mods list whenever a mod is checked.
Everything seems to work fine without it.
Whenever ticking or unticking a checkbox for a mod, the UI will freeze while the CollectionView attempts to refresh. The code in question here is as follows:
The line causing the lag here is the call to RefreshModsList. I've reviewed this code a little bit and we have a few options.
Force refresh a single GUI update so the checkbox appears to tick instantly
Run the refresh in the background
Optimise the refresh call
Honestly, I'm not 100% why the refresh call is there in the first place, the program seems to work perfectly fine without it. So, we might be able to completely remove the call.