ModAssistant icon indicating copy to clipboard operation
ModAssistant copied to clipboard

Ticking checkbox freezes UI while CollectionView refreshes

Open ghost opened this issue 6 years ago • 1 comments

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.

ghost avatar Sep 19 '19 04:09 ghost

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.

megalon avatar May 13 '21 06:05 megalon