public virtual void Update() { for (int i = Overlays.Count - 1; i >= 0; i--) { Overlays[i].Update(); } for (int i = Toasts.Count - 1; i >= 0; i--) { BaseToast toast = Toasts[i]; toast.Update(); if (toast.IsComplete()) { Toasts.RemoveAt(i); } } for (int i = Widgets.Count - 1; i >= 0; i--) { Widget widget = Widgets[i]; if (widget.Visible) { widget.Update(); } } }
public void Remove(Toast toast) { toast.Dispose(); toast.OnClose -= Remove; ToastLock.EnterWriteLock(); try { var index = Toasts.IndexOf(toast); if (index < 0) { return; } Toasts.RemoveAt(index); } finally { ToastLock.ExitWriteLock(); } OnToastsUpdated?.Invoke(); }