public void Clear() { Additions.Clear(); foreach (var tr in Contents) { Deletions.Add(tr); } PerformRemoves(); }
private void PerformAdds() { foreach (var tr in Additions) { _contents.Add(tr); Verbose(30, $"Adding {tr} to {this}"); tr.Completed += Remove; Added?.Invoke(this, tr); } Additions.Clear(); }
private void PerformAdds() { foreach (var tr in Additions) { _contents.Add(tr); tr.Completed += Remove; if (Added != null) { Added(this, tr); } } Additions.Clear(); }
private void AddRemove() { DataLock.WaitOne(); foreach (InstanceData t in Additions) { Data.Add(t); } foreach (InstanceData t in Removals) { Data.Remove(t); } Additions.Clear(); Removals.Clear(); DataLock.ReleaseMutex(); }
public void HandleAddRemoves() { AdditionMutex.WaitOne(); foreach (GameComponent component in Additions) { AddComponentImmediate(component); } Additions.Clear(); AdditionMutex.ReleaseMutex(); RemovalMutex.WaitOne(); foreach (GameComponent component in Removals) { RemoveComponentImmediate(component); } Removals.Clear(); RemovalMutex.ReleaseMutex(); }