bsmg / ModAssistant

Simple Beat Saber Mod Installer
MIT License
2.49k stars 418 forks source link

Ticking checkbox freezes UI while CollectionView refreshes #47

Open ghost opened 5 years ago

ghost commented 5 years ago

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.

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.

megalon commented 3 years ago

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.