public void EnqueuePopupThreadSafe(PopupViewModel popup) { lock (_lockerOfPopups) { _popups.Enqueue(popup); } }
private void OnTimerClick(object state, ElapsedEventArgs elapsedEventArgs) { if (!_canPopup.Invoke(null)) { return; } PopupViewModel newPopup = null; lock (_lockerOfPopups) { var newPopupExists = _popups.Count > 0; if (newPopupExists) { newPopup = _popups.Dequeue(); } } if (newPopup == null) { return; } OnNewPopupDequeued(newPopup); }
protected virtual void OnNewPopupDequeued(PopupViewModel obj) { NewPopupDequeued?.Invoke(obj); }