prevent some collection is modified errors

This commit is contained in:
goat 2023-04-10 21:18:23 +02:00
parent 4328826c86
commit b0906af1ba
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -206,7 +206,10 @@ internal class ProfileManagerWidget
{ {
if (ImGui.Button("Do it") && selected != null) if (ImGui.Button("Do it") && selected != null)
{ {
Task.Run(() => profile.AddOrUpdate(selected.Manifest.InternalName, selected.IsLoaded)); // TODO: handle error
profile.AddOrUpdate(selected.Manifest.InternalName, selected.IsLoaded, false);
Task.Run(() => profman.ApplyAllWantStates())
.ContinueWith(this.installer.DisplayErrorContinuation, "Could not change plugin state.");
} }
} }
@ -382,7 +385,9 @@ internal class ProfileManagerWidget
if (wantRemovePluginInternalName != null) if (wantRemovePluginInternalName != null)
{ {
Task.Run(() => profile.Remove(wantRemovePluginInternalName)) // TODO: handle error
profile.Remove(wantRemovePluginInternalName, false);
Task.Run(() => profman.ApplyAllWantStates())
.ContinueWith(this.installer.DisplayErrorContinuation, "Could not remove plugin."); .ContinueWith(this.installer.DisplayErrorContinuation, "Could not remove plugin.");
} }